" on stdout in c, without a new line. E ("CLIENT>"); Don't print enything. how can i...">

C stdout print without a new line?

I want to print "CLIENT>" on stdout in c, without a new line.
E ("CLIENT>");
Don't print enything. how can i solve this?

int main (){ printf("CLIENT>"); } 
+4
source share
3 answers

Try fflush(stdout); after printf .

You can also explore setvbuf if you often call fflush and want you not to call it at all. Keep in mind that if you write a lot of output to standard output, then performance will probably be reduced when using setvbuf .

+8
source

Call fflush after printf() :

 int main (){ printf("CLIENT>"); fflush( stdout ); } 
+4
source

In some runtime compilers / libraries (usually older), you must call fflush to physically write the data:

 #include <stdio.h> int main( void ) { printf("CLIENT>"); fflush(stdout); return 0; } 

If the data has a newline at the end, usually fflush not required - even on older systems.

+2
source

All Articles