从 Delphi 7 升级到 Delphi 2009

发布于 2024-10-08 15:55:14 字数 282 浏览 13 评论 0原文

我有一个 Delphi 7 项目,其中有一些记录类型包含加载并存储到文件中的字符串。
使用 Delphi 2009 重新编译后,当程序从文件加载记录时,字符串会变得混乱,因为编译器需要 Unicode,而文件包含 Ansi 字符串。
类型类似于:
<代码> 类型
T点=记录
名称:字符串[255];
x,y:整数;
结束;
用“ansiststring”替换“string”后,该项目甚至无法编译 “E2029”;“预期但发现“[””。 建议?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痴情换悲伤 2024-10-15 15:55:14

shortstring (字符串[255])仍然以与以前相同的方式解释:AnsiChar 数组,第一个字节作为其长度。 ansiststring 无法定义为数组,因此会出现错误消息。

如何读取文件来填充记录?你如何填充它们?也许错误就发生在那里。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文