Strange behaviour with fputs and a loop.
        Posted  
        
            by Jonathan
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Jonathan
        
        
        
        Published on 2010-03-22T07:32:28Z
        Indexed on 
            2010/03/22
            7:41 UTC
        
        
        Read the original article
        Hit count: 271
        
When running the following code I get no output but I cannot work out why.
# include <stdio.h>
int main()
{
    fputs("hello", stdout);
    while (1);
    return 0;
}
Without the while loop it works perfectly but as soon as I add it in I get no output. Surely it should output before starting the loop? Is it just on my system? Do I have to flush some sort of buffer or something?
Thanks in advance.
© Stack Overflow or respective owner