Category : C Source Code
Archive   : C-ALL.ZIP
Filename : TI727.ASC

Output of file : TI727.ASC contained in archive : C-ALL.ZIP

PRODUCT : Borland C++ NUMBER : 727
DATE : September 18, 1991 PAGE : 1/1

TITLE : Redirecting Output Before Spawn

How to redirect output before spawning a child process.

FILE *fp;
int handle;

fp=fopen( );
/* in this case, use "NUL" as the file, this is DOS's NULL device

execlp ( );

/*This will duplicate the file handle stdout to the FILE pointer
fp. Then dup2 is used to replace stdout with the new file opened
with fopen. Next, make your call to spawn. Finally, use dup2 with
the saved handle variable to restore stdout. */

  3 Responses to “Category : C Source Code
Archive   : C-ALL.ZIP
Filename : TI727.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: