C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-05-2002, 09:35 AM   #1
Registered User
 
Join Date: Jun 2002
Posts: 12
Question stderr quicky question

For example when I am directing a program's output to a file and then I look to that file I will be able to see the exact output that was redirected from stout to this file... Now if a program spits the output to this file and spits out a strerr error, how can I redirect that strerr so it doesn't print on the screen and yet I can check it out also...
for example
prog A spits its output to a file AA
prog B spits its output to a file BB and spits out an error message on the screen...
SO:
if [ cmp AA solution_file ]; and if correct, i.e. no stderr screen-print I can handle it easily, that is I consider it CORRECT...but

if [ cmp BB solution_file ]; I need to distinguish somehow that this comparison of files is in fact (physically) correct but it additionally generates a stderr message (that I need to hide from the screen) and I need to handle this BB as WRONG
How do I redirect stderr, and how can I check for it? Any help is greatly appreciated...
Thank you
HOWY
HOWY is offline   Reply With Quote
Old 07-05-2002, 09:52 AM   #2
Registered User
 
raimo's Avatar
 
Join Date: Jun 2002
Posts: 107
For example, when I start my X server, I redirect the messages and error messages to a file called ~/xauth/xlog:

startx >~/xauth/xlog 2>&1 &

2> redirects from error stream
&1 means the last mentioned place to output.
raimo is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
fprintf to stderr crash programs jlai Windows Programming 2 04-12-2005 08:51 AM
Question about pointers #2 maxhavoc C++ Programming 28 06-21-2004 12:52 PM
Question... TechWins A Brief History of Cprogramming.com 16 07-28-2003 09:47 PM
opengl DC question SAMSAM Game Programming 6 02-26-2003 09:22 PM
Question, question! oskilian A Brief History of Cprogramming.com 5 12-24-2001 01:47 AM


All times are GMT -6. The time now is 09:36 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22