TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: All
from: Mike Burgett
date: 1997-01-19 23:09:16
subject: Grabbing stderr....

I'm working on something that needs to redirect stderr from a spawned
child, and have tried doing it something like this:

HFILE piperead, pipewrite, hfNew = 2; /* stderr */

DosCreatePipe(&piperead, &pipewrite, 8192L);

/* pass the piperead handle off to another thread that uses PDCurses to 
   write it back to the screen, restricting it to a specific area. */

DosDupHandle(pipewrite, &hfNew);

/* spawn to create new child here */

So far, not much success.  Is there a better way to do this?  Re-directing
it to a file would be easier, since I wouldn't have to leave the clib
functions, but in view of the shucking and jiving I would have to do with
the file pointers, reading and writing from the same file, it seemed better
to do it this way.

My reader thread just treats non-zero length reads as string data.  Is
there any way to do an fgets style read on a HFILE?

(I seem to recall there was a lib function for turning a HFILE into a FILE*
so the clib functions could use it, but after searching the docs this
evening, I sure can't find it.)

Any help/pointers, greatly appreciated.

Thanks,
Mike

--- FleetStreet 1.18+
* Origin: Common Sense BBS - 510.713.7336 Newark, CA (1:215/705)
SEEN-BY: 50/99 54/99 270/101 620/243 625/110 160 711/401 430 808 934 712/311
SEEN-BY: 712/407 505 506 517 623 624 704 713/317 800/1
@PATH: 215/705 270/101 712/624 711/934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.