Hi all
I've got a (for me) very strange problem. I want to read data from a file via TFileStream into an array.
After the first loop, GMapTempBuffer[0, 0] contains a string like 'test1'. Everything ok so far.
After the next loop I would expect [0, 0] to contain still 'test1' and [1, 0] maybe 'test2'. But no, [0, 0] has been overwritten with 'test2'. [1, 0] is still empty.
Maybe I'm only have a big thinking-problem here, but I don't understand this. Can anybody help? Hope the explanation is not too stupid. :?
Here's the code for that stuff:
Code:
var
GMapTempBuffer: array[0..31, 0..31] of string;
c: string;
(...)
FileStream := TFileStream.Create(FileName, fmOpenRead);
try
for y := 0 to 31 do
begin
for x := 0 to 31 do
begin
FileStream.ReadBuffer(PChar(c)^, len);
GMapTempBuffer[x, y] := c;
GroundMap[x, y].Picfilename := GMapTempBuffer[x, y];
end;
end;
except begin
result := false;
FileStream.Free;
exit;
end;
end;
Thanx for any help,
Sven
Bookmarks