how flushing standard io

R

Robert Smith

I have some printf statements in my code and they arnt printing out. They
only print out with \n on the end. That tells me i need to flush the
buffer. But i dont know how.
I am using gcc and linux, dont know if that matters
 
B

Ben Pfaff

Robert Smith said:
I have some printf statements in my code and they arnt printing out. They
only print out with \n on the end. That tells me i need to flush the
buffer. But i dont know how.

fflush(stdout);
 
S

SM Ryan

# I have some printf statements in my code and they arnt printing out. They
# only print out with \n on the end. That tells me i need to flush the
# buffer. But i dont know how.
# I am using gcc and linux, dont know if that matters

You can use setvbuf(stream,0,_IONBF,0) to turn off buffering.
 
B

Barry Schwarz

I have some printf statements in my code and they arnt printing out. They
only print out with \n on the end. That tells me i need to flush the
buffer. But i dont know how.
I am using gcc and linux, dont know if that matters

Look up the fflush function.


<<Remove the del for email>>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top