Operating System - HP-UX
1755401 Members
2968 Online
108832 Solutions
New Discussion юеВ

Capturing the screen dump of CC

 
Helen_14
Occasional Contributor

Capturing the screen dump of CC

Hi, guys.

I want to capture the screen output of CC, warning and error messages, etc.. I tried both methods in your messages, i.e. sh > [file name] and script [file name]. But both capture only the commands, i.e. CC ..., but not its screen dump, i.e. warning and error messages. Actually, sh > and script behave similar to a simple redirection, >, in this case.

Any idea how to capture the warning and error messages of CC?

I'm running HP-UX 10.10 and 11.11, AIX, Solaris, etc..

2 REPLIES 2
Mark Grant
Honored Contributor

Re: Capturing the screen dump of CC

cc -blah -blah > cc.output 2>&1
Never preceed any demonstration with anything more predictive than "watch this"
A. Clay Stephenson
Acclaimed Contributor

Re: Capturing the screen dump of CC

That's because the error messages are directed to stderr (file descriptor 2) rather than stdout (fdes 1). This is actually a standard unix convention and ALL error messages and warnings should go to stderr while normal messages should be directed to stdout.

Your solution is rather simple:
cc -o myfile myfile.c 2>myerrs
If it ain't broke, I can fix that.