Article View: comp.unix.shell
Article #1534Output redirection
From: Abhay B. Joshi
Date: Thu, 18 Oct 1990 21:44
Date: Thu, 18 Oct 1990 21:44
29 lines
1073 bytes
1073 bytes
Hello Netters,
Following is a small C program.
-----------begin-------
#include <stdio.h>
main()
{
fprintf(stdout,"Some People\n") ;
fprintf(stderr,"Are In\n") ;
fprintf(stdout,"Very \n") ;
fprintf(stderr,"Deep\n") ;
fprintf(stdout,"Trouble\n") ;
}
-----------end---------
Try to compile and execute it in the following ways:
% a.out # prints "Some People Are In Very Deep Trouble"
% a.out >tmp 2>&1
% cat tmp # prints "Are In Deep Some People Very Trouble"
Sorry, I have removed the newlines between the words. But the sequence is
of importance.
Is there a way to keep the sequence the same, while using o/p redirection ?
Thanks.
Abhay Joshi
uunet!motcid!joshi
Technical Details
Message-ID:
<4859@graphite20.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!motcid!joshiShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!motcid!joshi From: joshi@motcid.UUCP (Abhay B. Joshi) Newsgroups: comp.unix.shell Subject: Output redirection Keywords: stderr stdout Message-ID: <4859@graphite20.UUCP> Date: 18 Oct 90 21:44:03 GMT Organization: Motorola Inc., Cellular Infrastructure Div., Arlington Heights, IL Lines: 29