|
From: Charles <cha...@at...> - 2001-12-03 21:34:24
|
André -
> I'am having some trouble with the portable solution Charles sent in
previous message. It workeb fine until I included one more printf() line
before it, like the following example. I had to replace it with the
system(pause) line.
...
printf("x value is: %d\n",som);
printf("Press ENTER to continue...");
fflush(stdout);
getchar();
> Note that I use stdio.h instead of cstdio, is it because of that?
Probably not.
Comment out the first printf. Does the program work now? If it does, look
in the first printf statement for a problem. What errors are the compiler
or the linker giving you? Did you define som?
I tried this program:
#include <cstdio>
int main(int argc, char *argv[]){
int som=100;
printf("x value is: %d\n",som);
printf("Press ENTER to continue...");
fflush(stdout);
getchar();
return 0;
}
and received this output:
x value is: 100
Press ENTER to continue...
By the way, #include <stdio.h> also works.
Chuck
|