Sometimes we put some debug prints in our code this way
printf(\"successfully reached at debug-point 1\\n\");
some code is here
printf(\"successfully reached
why all stream are by default line buffered
They are buffered for performance reasons. The library tries hard to avoid making the system call because it takes long. And not all of them are buffered by default. For instance stderr
is usually unbuffered and stdout
is line-buffered only when it refers to a tty.
then is this safe to do this?
It is safe to disable buffering but I must say it's not the best debugging technique.