adem0x / delphi-javascript

Automatically exported from code.google.com/p/delphi-javascript
0 stars 0 forks source link

TStreamWriter issue. Real reason of problem #15

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Hello!

The reason why TStreamWriter write only zero-char in file:

when you using Delphi, calling function:
    procedure TStreamWriter.WriteLine(const Value: string);

when you using JavaScript, calling function:
    procedure TStreamWriter.WriteLine(Value: Char);

Looks like function that responsible to found proper overloaded method doesn't 
work correctly.

With best regards,

Original issue reported on code.google.com by andre...@diatomenterprises.com on 6 Dec 2013 at 12:18

GoogleCodeExporter commented 9 years ago
How I solving it for now :)

I create my own class:

TMyStreamWriter = class (TStreamWriter)
    public
        procedure WriteStringLine (const Value: string);
    end;

With only one method, specially for string variable.

procedure TMyStreamWriter.WriteStringLine (const Value: string);
begin
    WriteLine (Value);
end;

Sample on JavaScript:

    var z = TMyStreamWriter ("C:\\Temp\\test9.txt", True);
    z.WriteStringLine ("abcdef100500!");
    z.Free ();

Original comment by andre...@diatomenterprises.com on 6 Dec 2013 at 12:40

GoogleCodeExporter commented 9 years ago
For strings of length 1 writeLine(char) will be called for other cases 
writeline(string)

Original comment by n.ame...@gmail.com on 6 Dec 2013 at 2:39