[net.lang.c] redirecting C error messages

rs (02/16/83)

How do I redirect error messages given by the C compiler to a file?
I am unsuccessful when I try to pipe them somewhere as they just
come out to my terminal!
				Thanks,
				Bob Switzer
				ph: 201-949-5133
				3G406 BTL
				Holmdel, NJ

alb (02/16/83)

That's because cc prints its error messages on stderr, nor stdout.
Say:
cc * 2>file
to redirect them.  This also means you have to say:
cc * 2>&1 | error
to pipe them into error (for example)

woods (02/17/83)

  I am sure this is obvious, but I feel like saying it anyway: 

  How to redirect stderr is VERY dependent on what shell you are using. If 
the method described in the last reply to this question doesn't work, you
could also try:

cc * >& file   (C-shell)

or use fd2 if you have it, e.g.

fd2 + cc * > file

                        GREG
			ucbvax!hplabs!hao!woods
			menlo70!hao!woods
			harpo!seismo!hao!woods
			decvax!brl-bmd!hao!woods

davy (02/18/83)

#R:spanky:-20900:pur-ee:15500009:000:188
pur-ee!davy    Feb 17 08:49:00 1983


	Adam's response is quite correct, provide you use "sh".  If you
	use "csh", the equivalent commands are:

		cc * >& errorfile

		      or
		
		cc * |& command

--Dave Curry
pur-ee!davy