3
votes

I have a Delphi 7 project in which there are some record types containing strings loaded and stored to files.
After recompiling with Delphi 2009, when the program loads the records from file, strings get messed up because the compiler expects Unicode while the file has Ansi strings.
The type is similar to this:
type
Tpoint = record
name: string[255];
x, y: integer;
end;
After substituting "string" with "ansistring" the project doesn't even compile saying "E2029 ';' expected but '[' found". Suggestions?

1
I think I will make the old application save as Unicode, looks simpler - M.G.
M.G. don't be too sure. Looks like you're giving up real easy. - Warren P

1 Answers

4
votes

shortstring (which string[255] is) is still interpreted the same way as before: an array of AnsiChar with the first byte as its length. ansistring can not be defined as an array, therefore the error message.

How do you read the file to fill the records? And how do you fill them? Maybe the error occurs there.