[fpc-pascal] Where is the 'write' function defined and how is it different from 'writeln'?

Florian Klaempfl florian at freepascal.org
Sat Mar 21 11:21:27 CET 2015


Am 21.03.2015 um 11:13 schrieb vfclists .:
> I need to get the output of a program which uses a lot of Write and
> Writeln commands into the GUI in realtime, by that I not having to
> output it to a text file and reading it afterwards, but by capturing the
> output of each Write command into a variable and displaying it in the
> GUI immediately.
> 
> If each Write or Writeln could trigger an event, I could use the event
> to capture the output. My other option is to replace the calls to write
> with my own function, but Write has different number of call parameters
> and it may require as many variants of the function as are used in the
> program, assuming that the call syntax is regular, not something like
> this one - write(JSValToDouble(cx,pom^)):1:scale).

Check the implementation of the FPC CRT unit how a unit can hook into
the write(ln) mechanisms:

http://svn.freepascal.org/cgi-bin/viewvc.cgi/trunk/packages/rtl-console/src/unix/crt.pp?revision=26372&view=markup

Have a look at AssignCrt and CrtOpen, how it is done.



More information about the fpc-pascal mailing list