Mail Archives: djgpp/2000/01/29/17:27:24
Hans-Bernhard Broeker wrote:
> arcadepreserv AT hotmail DOT com wrote:
> > I think it is possible to trap a interrupt that accurs when a call to
> > printf is made, and then read the string a pointer is pointing to.
>
> You cannot trap that particular interrupt, just like so, because it is
> not an interrup of its own.
>
> To begin with, printf() is not implemented by any interrupt at
> all. It's a library function built into the program's code. At the
> very heart of its operation, there will of course be a DOS interrupt
> call (the 'write something to file' one), but even that you cannot
> easily trap from the parent process --- it occurs in the *child*, so
> if at all, the child would have to trap it. But that'd mean you'ld no
> longer be building a frontend for the other code, but instead modify
> that existing code iteself. Probably not what you wanted.
>
Are you saying that if parent redirects int 21 to itself and calls another
program,
the startup code will redirect it back to dos? I am no DJGPP GURU but I
doubt that.
>
> If it's really plain printf() output you want to grab, you can spare
> yourself the work and use DJGPP's library function 'popen()', instead
> of 'system()' or similar, to call that child. It can automatically
> catch all its standard output (asynchronously, i.e. you'll get it
> after child process termination) and present it to you as a pseudo
> Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
> Even if all the snow were burnt, ashes would remain.
- Raw text -