Im trying to print some error messages in my code, and I need to show the error immediately when they appear, Using it like this works :
> cout << "erroe msg" << endl;
But with cerr the print isnt consestent
> cerr<< "error msg" << endl;
Isnt endl
on stderr
flush the buffer the same way it dose with stdout
?
minimal example :
int uthread_block(int tid){
block_alarm();
if(tid == 0){
cerr <<"thread library error: You cannot block the main thread\n" << endl;
return -1;
}
This function is used sometimes while going throw 100 thread in my program and sould be print an error message in a specific time. If ill change cerr
to cout
it will be correct at the time, and with cerr
it can be show at the start of the output the end or the middle ( probable when it flushing the buffer)