"printf()" hangs machine 
Author Message
 "printf()" hangs machine

Hello all,

This may be a relatively simple question, but I have come across it
before and it has me completely stumped. I am using the SunOS Unix "cc"
C-compiler and have tried the GNU project "gcc" compiler as well.
Essentially it would seem that printf() statements are{*filter*} the
execution of a program.

I have a program which contains the following simple line (a
master-and-slaves distributed processing system, in case anyone wanted to
know about the slaves thing):

        printf("unenrolling slaves");

and it hangs. However changing it to

        printf("\nunenrolling slaves");

gets it to execute and it then hangs on the next printf() statement. Why
is this? Have I written a funny character to the screen prior to this
which might cause it? I have checked them, but could using an incorrect
format spec in printf("%d", myInteger) cause this problem?

I have found that the problem also occurs if the \n newline escape
sequence is at the end of printed strings, but not, as far as I know, if
it occurs before. If someone could shed some light on this completely
inexplicable problem, I'd be grateful!


Jon Hinks
Comp Science
University of Coventry

Tue, 13 Aug 2002 03:00:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. "MessageBox.Show(" Intellisense hang

2. app hang at SetText("1");???????????????

3. VC 5.0 Hangs when "Generating Code..."

4. GUI is "hang", need help.

5. Hangs during "Launching Debugee...."

6. printf("%d",1.0/3*3)

7. printf("/033E")

8. printf("%g") to 3 sig figs

9. "implicit declaration of function printf"

10. Behaviour of printf("[%.0g]",1.0)

11. printf("%x",string_buffer); - Output question

12. C source code for "printf"


Powered by phpBB® Forum Software