Article View: alt.msdos.programmer
Article #1150Redirection of STDERR ??
From: Fred (Frot)
Date: Wed, 15 Nov 1995 15:16
Date: Wed, 15 Nov 1995 15:16
41 lines
1619 bytes
1619 bytes
Hello,
At the moment I am developing some kind of tool to call (spawn/exec)
other commands (using swap of memory) in MS-DOS.
In order not to disturb the screen by messages from the called program
I use redirection of stdout.
e.g. 'dir > \it.txt'
I encountered a problem when this called program writes something to
stderr. These messages are not redirected to the file, but corrupt the
screen display and confuse the ignorant user.
So I want to do something like under UNIX command-line :
ls > /dev/null 2>&1
or redirecting the stderr in the calling program to stdout (which I
think would be the best), but I don't know how to do this.
void main()
{
......... // Some code
fclose(stderr); // I know this does not work,
// but the intention is closing the stderr for the next prog.
spawnv(P_WAIT, .........) ; // Call the programm
freopen(stderr), // Does not work either, but reopen the stderr
is
// needed for its own messages.
........... // Some error detection from spawn
}
If someone could shine some light on this, I would be very gratefull !
Fred
Fred.Dullemond@Austria.attgis.com
Technical Details
Message-ID:
<DI3BnA.JF5@news.zippo.com>Path:
arc1-ca.pugleaf.net!news3.noc.netcom.net!zdc!zippo!usenetShow Full Headers
Complete Article Headers
Newsgroups: alt.msdos.programmer,comp.lang.c,comp.msdos.programmer,comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!news3.noc.netcom.net!zdc!zippo!usenet From: Fred.Dullemond@Austria.ATTGIS.COM (Fred (Frot)) Subject: Redirection of STDERR ?? X-Newsreader: Forte Free Agent 1.0.82 Sender: usenet@news.zippo.com Nntp-Posting-Host: 192.127.84.153 Organization: Zippo Message-ID: <DI3BnA.JF5@news.zippo.com> Date: Wed, 15 Nov 1995 15:16:38 GMT