is it possible to redirect stdout so that everytime I call writeln() the output is sent to a function that accepts a string instead of stdout?
I have googled for some hours now and looked into the CRT unit but I somehow cannot figure out how this mechanism is supposed to work. I understand that somehow I have to change a few (which ones?) pointers in a textrec record to some functions that I provide but I have no clue how this all is supposed to work. What exactly happens when I write to stdout, which functions are called and in which order and where and how can I hook into this whole thing to receive the string that has been written? I need some holding hands now, a simple "look how crt does it" won't help because I first need to understand the concept of what is going on with this textrec variable. Say I have a procedure foo procedure foo(s: ansistring); begin // some code to send this string somewhere else end; What are the absolute minimum needed things (no extra bells and whistles) that I have to do so that foo() will be called on every call to writeln() and receives the string? Is there any documentation about this that i should have read before asking this question? I could not find anything, at least not online, maybe because it is all old pre-www turbopascal knowledge that can be only found in books, and everything the CRT unit does (i don't even know what exactly it does and what it is used for, I only know that it seems to somehow amongst other things messes around with stdout/stdin) seems to be undocumented voodoo magic to me. Bernd _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
