Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
usefulcat
on May 6, 2024
|
parent
|
context
|
favorite
| on:
Results of the Grand C++ Error Explosion Competiti...
> just piping the compiler output to less or head also doesn't work, because the errors go to stderr
|& is your friend:
g++ foo.cc |& less
imron
on May 6, 2024
|
next
[–]
How did I not know this until now. Fantastic.
fransje26
on May 7, 2024
|
prev
|
next
[–]
Or, if you want to save the output to a log file:
g++ foo.cpp 2>&1 | tee ./log
or, the shorthand of 2>&1 |:
g++ foo.cpp |& tee ./log
dmitris
on May 7, 2024
|
prev
[–]
I like to do `g++ foo.cc |& tee /tmp/out` then you can `less /tmp/out`, grep the file, open it in an editor etc.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search:
|& is your friend:
g++ foo.cc |& less