How do you pause a program?

This is a discussion on How do you pause a program? within the C Programming forums, part of the General Programming Boards category; Hi, could someone please tell me what function pauses a console program to stop it from dissapearing at the end. ...

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    49

    Question How do you pause a program?

    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

  2. #2
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    did you hear about the incredible FAQ?
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    18
    here go!
    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;
    }
    Wait to have help u!
    /**************Um abraço*************/

  4. #4
    former member Brain Cell's Avatar
    Join Date
    Feb 2004
    Posts
    472
    Code:
    char ch;
    'ch' should be an 'int' because thats what 'fgetc()' return.
    fgetc()'s prototype :
    Code:
    int fgetc(FILE *stream);
    Code:
    while((ch=fgetc(stdio))!='\n');
    did you even test your code before posting it?
    VC++6 error : error C2065: 'stdio' : undeclared identifier
    it should be 'stdin' not 'stdio'.
    My Tutorials :
    - Bad programming practices in : C
    - C\C++ Tips
    (constrcutive criticism is very welcome)


    - Brain Cell

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Why doesn't this cin.get() pause the program?
    By Loctan in forum C++ Programming
    Replies: 5
    Last Post: 06-24-2006, 04:06 PM
  2. Need help with my program...
    By Noah in forum C Programming
    Replies: 2
    Last Post: 03-11-2006, 06:49 PM
  3. I need some help with my program please.
    By agentxx04 in forum C Programming
    Replies: 9
    Last Post: 09-26-2004, 07:51 AM
  4. How do I make my program pause
    By quiksilver9531 in forum C++ Programming
    Replies: 9
    Last Post: 01-23-2002, 06:38 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21