hi,
whenever i try to write records into the file, only the first piece of records can be written. even some simple program like the following cant work properly.
type thing=record
name:string;
end;
var f:file of thing;
data:array [1..2] of thing;
i:integer;
begin
assign(f, 'infile.txt');
rewrite(f);
data[1].name:='name';
data[2].name:='second';
for i:= 1 to 2 do
write(f, data[i]);
close(f);
end.
when i open 'infile.txt', only 'name' is shown but not 'name ' and 'second'. however, turbo-pascal works perfectly when array is written back into text file.
var f:text;
data:array [ 1..2 ] of string;
i:integer;
begin
assign(f, 'infile.txt');
rewrite(f);
data[1]:='name';
data[2]:='second';
for i:=1 to 2 do
writeln(f, data[i]);
close(f);
end.
in this program, both 'name' and 'second' are shown. i am using both turbo-pascal and dev-pascal. is it the problem of my problem or the pascal software?????
thx for help!!!
grace