Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird output problem

Status
Not open for further replies.

bitwise

Programmer
Mar 15, 2001
269
US
In a loop I'm trying to output a character each time through the loop after a recv() on a socket. The loop looks something like this:

for(;;) {

numbytes = recv(...);
if(numbytes <= 0) break;
printf(&quot;*&quot;);
}

printf(&quot;complete&quot;);

Granted, that is very minimal and trival. Anyway, the printf(&quot;*&quot;); statement never prints out a * until the printf(&quot;complete&quot;); statement gets executed. However, if I replace printf(&quot;*&quot;); with printf(&quot;*\n&quot;); it will print out each time through the loop. Why do I need the newline character to get this to work? I don't want a newline! Any thoughts?

Thanks so much,
-bitwise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top