[fpc-pascal] Where is the 'write' function defined and how is it different from 'writeln'?
vfclists at gmail.com
Sat Mar 21 11:13:19 CET 2015
On 20 March 2015 at 20:54, Sven Barth <pascaldragon at googlemail.com> wrote:
> On 20.03.2015 21:18, vfclists . wrote:
>> On 20 March 2015 at 19:34, Sven Barth <pascaldragon at googlemail.com
>> <mailto:pascaldragon at googlemail.com>> wrote:
>> Am 20.03.2015 19:19 schrieb "vfclists ." <vfclists at gmail.com
>> <mailto:vfclists at gmail.com>>:
> How do you ensure own implementation overrides the system's
>> implementation, does the compiler take care of that automatically, or
>> will you have to name your function differently?
> There is no need to ensure that. Here is an example:
> === code begin ===
> f, oldout: TextFile;
> Writeln('Hello Output as StdOut');
> oldout := Output;
> Assign(Output, 'test.txt');
> Writeln('Hello Output as file');
> Output := oldout;
> Writeln('Hello Output as StdOut again');
> === code end ===
> To see how such a TextFile is implemented you can take a look at unit
> StreamIO which is part of FPC's units.
> (Though I wonder why "Assign(f, 'test.txt'); Output := f; Writeln('Hello
> Output as file');" does not work :/ )
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
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 -
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal