On Wed, Dec 27, 2023 at 3:42 PM Wayne Sherman wrote:
> Example using a TFileStream descendant and StreamIO AssignStream:
> ...(line 42 follows)
> FileWrite(TextRec(Output).Handle, Buffer, Count);
Although that worked (I don't know why) I intended line 42 to be:
FileWrite(TextRec(FOriginalStdOut)
Example using a TFileStream descendant and StreamIO AssignStream:
program TeeStdOut;
{$mode objfpc}
uses
Classes, SysUtils, StreamIO;
type
TTeeStream = class(TFileStream)
Private
FOriginalStdOut: Text;
FNewStdOut: Text;
public
constructor Create(const AFileName: string; Mode:
Am 27.12.2023 um 12:25 schrieb James Richters via fpc-pascal:
I wanted to write what I thought should be a simple procedure, just
instead of calling WRITELN() with some arguments,
call WRITELOG() with the same arguments that you would use to write to
a file, but my WRITELOG() procedure would
On Wed, Dec 27, 2023 at 3:25 AM James Richters wrote:
> I wanted to write what I thought should be a simple procedure, just instead
> of calling WRITELN() with some arguments, call WRITELOG() with the same
> arguments that you would use to write to a file, but my WRITELOG() procedure
> would write
It would be very useful if WriteStr() was a function that returned the
resulting string instead of returning it via an output parameter. Then you
could just wrap the Writeln parameters in WriteStr() and pass it to the new
logging procedure. Unfortunately, the ISO extension did not end up doing t
>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
, 'Number 2', 3, 4.0]);
- Original Message -
From: Michael Van Canneyt via fpc-pascal
To: ja...@productionautomation.net
Sent: Wednesday, December 27, 2023, 12:40:24
Subject: [fpc-pascal] Procedures that work like WRITELN()
On Wed, 27 Dec 2023, James Richters via fpc-pascal wrote:
>
On Wed, 27 Dec 2023, James Richters via fpc-pascal wrote:
I wanted to write what I thought should be a simple procedure, just instead
of calling WRITELN() with some arguments,
call WRITELOG() with the same arguments that you would use to write to a
file, but my WRITELOG() procedure would
writ
I wanted to write what I thought should be a simple procedure, just instead
of calling WRITELN() with some arguments,
call WRITELOG() with the same arguments that you would use to write to a
file, but my WRITELOG() procedure would
write to the screen and the file.. but I can't figure out how to pa