delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/29/17:27:24

Message-ID: <389354F6.F725C6F1@connection.com>
Date: Sat, 29 Jan 2000 16:00:40 -0500
From: sam <samirw AT connection DOT com>
X-Mailer: Mozilla 4.6 [en] (Win95; I)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How Do I catch a "printf interrupt" ?
References: <86n3vr$dll$1 AT nnrp1 DOT deja DOT com> <86pji0$g3g$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: 216.13.20.166
X-Trace: 29 Jan 2000 16:00:24 -0500, 216.13.20.166
Lines: 37
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019