Strange problem in textfile
Hi,
I have encounter a strange problem when reading a text file.
var
f1:TextFile;
aline:string;
begin
Assignfile(f1,'foo.dat');
reset(f1);
while not eof(f1) do
begin
readln(f1,aline);
{ do something about the text}
end;
end;
When the computer hang up, I trace the program and found out that the
first line it read the aline actually contains the entire file. I
though may be the file does not containing any carriage return
character. But IDE show the the text enclosed in quotes for each line
followed by #$ after each line. All this in aline string. However it
read into the memo component just fine. After I delete the first line,
then the program read each line corectly. My question is what's wrong
with the first line that cause readln to read the entire file into a
string. Why after I delete the first line, everything works.
Your help/ comment will be appreciated. Thanks.
chaoc