Hanging of program

I’m tryin out a self written program but everytime i run the program it seems to stop at a certain location without proceeding. I’ve put several printf statements to check where is the latest part of the program it had proceeded but it can’t seems to “go pass” a certain “mark”. Are there any way i can overcome this problem?

Compile the program with -g option and use gdb rather that putting printfs. Ex. gcc -g test.c -o test. Please note that you may not get the exact point of trouble just by using printfs.

IF that does not help, post the source.

Also the output of pidin at the point your program hangs will show what you are blocked on - which will explain by it is blocked (or that it is running ready).

vishwa2000; what’s wrong then printfs ;-)

rldchua you will have to give more information, this is way to vague.

I have a very bad experience when I used printfs for debugging. I have no much idea but as printfs are buffered, it may give some incorrect results.

Only stdout is buffered, stderr is not.

fprintf(stderr, “…”);

It’s buffered but a /n at the end of the line will flush it.

Please do not use name “test” and do not advise other people to use name “test” in un*x environment.