[Gs-devel] error using stdout callback function

Russell Lang gsview at ghostgum.com.au
Fri Sep 28 14:24:11 PDT 2001


Michael,

> so i made all the changed and stdout still goes to stdout and not to
> the callback function.  however, stderr does get trapped by the
> callback (this was the case earlier as well but i forgot to mention
> it).  so now you see my confusion, one of the two callback is only
> working.
> 
> any other thoughts?

stdout from a device will never go to the callback.
Using -sstdout=%stderr only redirects PostScript stdout.
Device stdout (-sOutputFile=-) will always go to the C file stream.

> > 3. write to "%handle%XXXXXXXX" where XXXXXXXX is the hexadecimal
> > value of the handle.  Your program would call CreatePipe() and give 
> > the write end to Ghostscript, then read the other end from another 
> > thread.  I use this method in GSview to render to a BMP, pipe it back 
> > to GSview then blit it to a printer.
> 
> i may try this, i was hoping the stdout callback would work since this
> was the easiest method.
> 
> > 4. write to stdout and intercept it in the callback.  You must use GS 
> > 7.02 and -sstdout=%stderr as you did in your code otherwise
> > PostScript stdout and driver stdout will be mixed.

Sorry, as I wrote above, this won't work if you want device stdout.
You can still capture device stdout, but the method is different.
You need to create a pipe, the set the stdout standard handle before 
you start Ghostscript.  It would be easier to use method 3.



Russell Lang                   gsview at ghostgum.com.au
Ghostgum Software Pty Ltd      http://www.ghostgum.com.au/




More information about the gs-devel mailing list