使用下列的代码读取test.ini文件中的电文信息区的电文内容的值,发现读取的内容为“一切都好!”,与实际的内容不一致。麻烦大侠各给看下,是什么问题?
procedure TForm1.ReadDataBtn(sender : TObject);
var
filepath : string;
msgstr : string;
begin
filepath := 'test.ini';
with TIniFile.create(filepath) do
try
tempstr := ReadString('电文信息', '电文内容', '');
self.memo1.lines.add(tempstr);
finally
free;
end;
end; 注:电文内容是四行数据,行与行之间有换行符。
test.ini文件的内容
[电文信息]
电文内容=一切都好!
在路上!
谢谢!
最近好吗?
procedure TForm1.ReadDataBtn(sender : TObject);
var
filepath : string;
msgstr : string;
begin
filepath := 'test.ini';
with TIniFile.create(filepath) do
try
tempstr := ReadString('电文信息', '电文内容', '');
self.memo1.lines.add(tempstr);
finally
free;
end;
end; 注:电文内容是四行数据,行与行之间有换行符。
test.ini文件的内容
[电文信息]
电文内容=一切都好!
在路上!
谢谢!
最近好吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货