我得到了一个较旧项目的来源,并且必须改变一些小东西,但是我遇到了大麻烦,因为我只有delphi 2010才能做到这一点.
有一个记录定义:
bbil = record
path : string;
pos: byte;
nr: Word;
end;
Run Code Online (Sandbox Code Playgroud)
以后这个定义用于从文件中读取:
b_bil: file of bbil;
pbbil: ^bbil;
l_bil : tlist;
while not(eof(b_bil)) do
begin
new(pbbil);
read(b_bil, pbbil^);
l_bil.add(pbbil);
end
Run Code Online (Sandbox Code Playgroud)
主要问题是,编译器不接受记录中的"字符串"类型,因为他想要"完成".所以我试着将"string"改为"string [255]"或"shortstring".这样做应用程序正在读取文件但内容错误.
我的问题是如何将用于编写文件的旧"字符串"类型转换为Delphi 2010中的"新"类型.
我已经尝试了很多例如"{$ H-}".在记录显示中只添加一个char更多,文件是正确的,因为文件读取几乎正确,但每个数据集截断一个char更多 - lengthbyte + 255chars的长度似乎是正确的fpr定义但shorttring不匹配.