Gentlefolk,
Lazarus 0.9.29 snapshot (using to address other issues with dbgrid), windows xp, SP-3.
I have a peice of delphi code which I have migrated to lazarus. The Lazarus code is to load the 'fields' in a .CSV file to a BufDataset, the code crashes on 'LoadfromStream' with the following error message:
"the data stream format is not recognised".
The executed code is
F := TFileStream.Create(FileName, fmOpenRead);
S := TMemoryStream.Create;
try
S.SetSize(F.Size + 2);
P := S.Memory;
Move(CrLf[1], P^, 2);
Inc(P, 2);
F.ReadBuffer(P^, F.Size);
MT.LoadFromStream(S, dfAny);
The file contains one line of text '123,"test description","F","T"'.
After the ReadBuffer P contains '123,"test description","F","T"r'.
Looking at the code in Bufdataset. and Bufdataset.TFpcBinaryDatapacketReader.RecognizeStream shows the code doing some strange things where it compares
#13#10'123,"test d' against FpcBinaryIdent = 'BinBufDataset';
this fails and it is all down hill from there.......
Any ideas, solutions, explanation, examples of using a LoadFromStream with BufDataset appreciated.
thanks, Ian.