G
George B
When I redirect standard output, I would like to duplicate a few lines of
this output to the console. If I add duplicates of the desired source
statements, changing cout to cerr, it works fine, but I end up with
duplicated lines when the program is executed without redirection. Is there
a way to test cout to tell whether its output is being redirected?
Like,
cout << "This information is very important" << endl;
if (cout_is_redirected) {
cerr << "This information is very important" << endl;
}
Thanks,
George
this output to the console. If I add duplicates of the desired source
statements, changing cout to cerr, it works fine, but I end up with
duplicated lines when the program is executed without redirection. Is there
a way to test cout to tell whether its output is being redirected?
Like,
cout << "This information is very important" << endl;
if (cout_is_redirected) {
cerr << "This information is very important" << endl;
}
Thanks,
George