以上代码改为这样即可!var
F:System.TextFile; //是你这里没有写对吧???
s:array[0..5] of String; //如果是动态数据注意设定长度.
i:integer;
begin
AssignFile(F,'aaa.txt');
Reset(F);
While not eof(F) do
begin
Readln(F,s[1]);
i:=i+1;
end;
F:System.TextFile; //是你这里没有写对吧???
s:array[0..5] of String; //如果是动态数据注意设定长度.
i:integer;
begin
AssignFile(F,'aaa.txt');
Reset(F);
While not eof(F) do
begin
Readln(F,s[1]);
i:=i+1;
end;
Reset(F);
i:=0;
While not eof(F) do
begin
Readln(F,s[i]);
i:=i+1;
showmessage(s[i]); //字符串为什么为空?改为Readln(F,s[1])则能正常显示
end;