I'm a total beginner at this, but I'm thinking it will be very useful to me. I'm not sure if this is supposed to be in the UNIX/Linux section or not, but I found that an answer to this is likely to attract and help beginner programmers who are programing on Linux.
Is anyone willing to guide me through piping and directing output in the Linux terminal? Just write a short article on the matter explaining a few of the most used functions
Is it possible to pipe information into function of another program?
This is my compiling command atm:
g++ file.cpp -o program -Wall -Wextra -Werror 2> Compile.txt
I get output like this ( Don't worry about the errors they are purposely made to test this )
ostreamoverloading.cpp:27:1: error: ‘friend’ used outside of class
friend std::istream &operator>> (std::istream& is, Obj& o)
^
ostreamoverloading.cpp: In function ‘std::istream& operator>>(std::istream&, Obj&)’:
ostreamoverloading.cpp:9:17: error: ‘std::string Obj::output’ is private
std::string output;
^
ostreamoverloading.cpp:30:24: error: within this context
std::getline(is, o.output;
^
ostreamoverloading.cpp:30:30: error: expected ‘)’ before ‘;’ token
std::getline(is, o.output;
|
I'm wondering if I can get the output more like:
Compile.txt
ostreamoverloading.cpp:27:1: error: ‘friend’ used outside of class
ostreamoverloading.cpp:9:17: error: ‘std::string Obj::output’ is private
ostreamoverloading.cpp:30:30: error: expected ‘)’ before ‘;’ token
|
If I can't do something like that, perhaps another way is redirecting it to another program which will parse it?
Something like:
g++ file.cpp -o program -Wall -Wextra -Werror > ./ErrorParser > Parsed.txt
I'm looking forward to responses!