Thread View: comp.os.os2.programmer.misc
1 messages
1 total messages
Started by Keith Bennett
Thu, 01 Sep 1994 17:30
Problems Redirecting Stdout/Stderr
Author: Keith Bennett
Date: Thu, 01 Sep 1994 17:30
Date: Thu, 01 Sep 1994 17:30
33 lines
2390 bytes
2390 bytes
I have a PM app which consists of a process which starts another process which in turn starts another process. DosStartSession() is used to start the child processes. I would like to redirect stdout and stderr to separate files for each process. I used _open() and dup2() to do the redirection, but no matter which flags I passed to _open(), the contents of the file were always overwritten. Then I tried freopen(). All three process succeeding in opening the output files, but only the first process could get any output in that file. The others had a file size of zero. Thinking that it might be related to a file buffer that didn't get flushed, I tried using setbuf() to unbuffer the files. That didn't change anything. When I started #2 directly from the command line, the output showed up. I then thought that maybe #2 inherited the redirected file handle from #1, and instead of redirecting again, simply output some text using printf(), expecting it to show up in #1's file. It didn't. By the way, I would also have liked to redirect both stdout and stderr to the same file for each executable, but couldn't get that to work, so I settled on two separate files for each process. Can anyone shed some light on these issues? Thanks very much. - Keith -- -------------------------------------------------------------------------- Keith Bennett Bennett Business Solutions, Inc. C++/C Software Development 1852 Middlebridge Drive kbennett@cpcug.org Silver Spring, MD USA 20906
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads