BUG: TFileStream ?

edited September 2004 in FastScript
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

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 5:49AM
    Hi Brian
    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. ;)

  • edited September 2004
    I figured it out, finally....

    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.