Hi, could someone please tell me what function pauses a console program to stop it from dissapearing at the end.
Is it readln() or something like that?
Thanks :)
Printable View
Hi, could someone please tell me what function pauses a console program to stop it from dissapearing at the end.
Is it readln() or something like that?
Thanks :)
did you hear about the incredible FAQ? ;)
here go!
Wait to have help u!Code:int main(){
char ch;
printf("Press one key for continue...");
while((ch=fgetc(stdio))!='\n');
printf("You hit the key %c!",ch);
return 0;
}
'ch' should be an 'int' because thats what 'fgetc()' return.Code:char ch;
fgetc()'s prototype :Code:int fgetc(FILE *stream);
did you even test your code before posting it?Code:while((ch=fgetc(stdio))!='\n');
it should be 'stdin' not 'stdio'.Quote:
VC++6 error : error C2065: 'stdio' : undeclared identifier