>Writeln() is special. You cannot duplicate it.
That's good to know, I can stop trying.

>What you can do is use WriteStr(), it has the same action as Writeln() but
writes to a string instead of a file.

I was hoping to just replace all existing Writeln()s with my procedure with
a global search and replace.
I think it's probably easiest to make my procedure:

Procedure WriteLog(Filename:String, WriteString:String);
Begin
    Writeln(Filename,WriteString);
    Writeln(WriteString);
End;

Then just fix the call to concatenate everything into a single string:

So if I end up with this:
WriteLog(Myfile,'some text ',MyInteger);

I'll have to change it to this:
WriteLog(Myfile,'some text '+InttoStr(MyInteger));

And if the arguments are really complicated I can just use WriteStr() to
store it into a string and call my procedure with the resulting string.

It will be a little more effort than doing a global search and replace but
at least I know that it's the only way.

Thanks for the help

James



_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to