BUG: TFileStream ?
This should run as is, shouldn't it?
Stepping through source Params[0] is assigned,
But returns an empty 'buffer'
(note: c:\22.txt is a file with a single line of text)
==============
var
fs : TFileSTream;
s,buffer : String;
count,res:longint;
begin
fs := TFileStream.Create('c:\22.txt',fmOpenRead);
count := 1000;
res := fs.Read(Buffer,Count);
showmessage(buffer);
fs.free;
end.
==============
Your thoughts?
Brian
Stepping through source Params[0] is assigned,
But returns an empty 'buffer'
(note: c:\22.txt is a file with a single line of text)
==============
var
fs : TFileSTream;
s,buffer : String;
count,res:longint;
begin
fs := TFileStream.Create('c:\22.txt',fmOpenRead);
count := 1000;
res := fs.Read(Buffer,Count);
showmessage(buffer);
fs.free;
end.
==============
Your thoughts?
Brian
Comments
I'm not fs person
but i would expect that since showmessage requires a string you can't pass
the buffer to it directly. probably have to write characters in buffer to a string.
The source code (fs_iclassesrtti.pas) defines the buffer wrong, should be 'var' buffer.
with AddClass(TStream, 'TObject') do
begin
AddMethod('function Read(var Buffer: string; Count: Longint): Longint', CallMethod);
Then it works fine.