Reputation: 319
Is there any flag for gcc
or g++
that turns the buffering off for stdout
?
Like python -u
turns off buffering of stdout
,stdin
and stderr
in python.
Upvotes: 0
Views: 450
Reputation: 2106
GCC, as a compiler, only generates an executable. It has no real knowledge of buffering or even of streams. Only the C runtime knows what your stdout
and stderr
are. You need to tell the C runtime, at obviously runtime, to disable buffering.
By comparison, the Python runtime is an interpreter. As an interpreter, it is the one to set up your streams and can disable the buffering if you ask it to.
Upvotes: 3