Click to See Complete Forum and Search --> : printf problem!


niloufar
09-22-2002, 09:44 PM
Hello,

I just installed Mandrake 8.2 on my system. I wrote a simple program to see if gcc is working correctly. I don't get any error messages when I compile the program, but the printf command doesn't work (nothing is written to the screen).
The program is simply:

#include <stdio.h>

int main(){

printf("something...\n");
return 0;

}

I also added fflush(stdout); but it still doesn't work. I don't know if anyone else has had this problem? I would appreciate it if someone could advise me.
Best,
niloufar

TacKat
09-22-2002, 09:57 PM
That program as you posted works just fine. Could you explain more about what you are doing? *Exactly* what are you typing to run it?

niloufar
09-22-2002, 10:06 PM
Thank you for your reply.

To compile i typed:

"gcc -o test test.c"

and then i typed:

"test", to run the program.

demian
09-22-2002, 10:19 PM
Try ./test instead.

TacKat
09-22-2002, 10:19 PM
The current directory is not in your path by default ("echo $PATH" to see the list). So running "test" isn't running what you think it is. It is actually running the program /bin/test. What you want to type is "./test". This tells bash to look in the current directory (.) for test and run it.

niloufar
09-22-2002, 11:09 PM
Thank you so much for your help!
./test works!

Best,
niloufar