Reputation: 1339
I have C++ program called MyApp
like below
#include <iostream>
int main(int argc, char *argv[]) {
for(int a = 0; a < 50; a++) {
std::cout << "Hello stackoverflow" << std::endl;
}
return 0;
}
I built it for Linux to run as a console application. I run it from the terminal just by calling it with the following command.
MyApp & >> /some/output.txt
Question:
As you can see above, I want the log output to go into /some/output.txt
. That works great. But the problem is that the logs parallel to adding the cout
s into the txt file, it keeps spamming the console as well! How can I make the cout
s go into /some/output.txt
and not spam the console? Is there a way to do that or should I have to change the C++
logic in MyApp
to do that?
Upvotes: 2
Views: 1449