Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
562 views
in Technique[技术] by (71.8m points)

printf - c stdout print without new line?

i want to print "CLIENT>" on stdout in c, without new line.
printf("CLIENT>");
does not print enything. how do i solve this?

int main (){
printf("CLIENT>");
}
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try fflush(stdout); after your printf.

You can also investigate setvbuf if you find yourself calling fflush frequently and want to avoid having to call it altogether. Be aware that if you are writing lots of output to standard output then there will probably be a performance penalty to using setvbuf.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...