Thread: Ascii value for "break" key

  1. #1
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77

    Ascii value for "break" key

    Does anyone know the ascii value for the pause/break key?

  2. #2
    Registered User MisterBadger's Avatar
    Join Date
    Mar 2002
    Posts
    16

    Smile

    The code for the <Escape> key is 0x1B (no quotes) if that's what you're after...
    Code:
      
      printf("* * * * * MAIN MENU * * * * *\n\n");
      printf("PLEASE SELECT:\n\n");
      printf("SOMETHING #1 <1>\n");
      printf("SOMETHING #2 <2>\n\n");
      printf("TO QUIT PROGRAM PRESS <Esc> ");
      ch=getch();
    
      switch(ch)
      {
    	case '1'    : something_to_do;
    	                  break;
    	case '2'    : something_a_bit_different;
                                      break;
    	case 0x1B: break;
    	default     : printf("* * * <%c> IS NOT A VALID SELECTION * * *\a",ch);
    		  break;
    	} /* end switch */
    
     if(ch==0x1B) break;  /* from a while loop... */
    Hope it helps...
    Cheers from MrB

  3. #3
    Registered User WayTooHigh's Avatar
    Join Date
    Aug 2001
    Posts
    101

    Re: Ascii value for "break" key

    Originally posted by SavesTheDay
    Does anyone know the ascii value for the pause/break key?
    to my knowledge, the pause/break key doesn't have an ascii value. but the virtual-key code is VK_PAUSE.
    Sometimes, the farthest point from the center is the center itself.

    Your life is your canvas, it's only as beautiful as you paint it.

  4. #4
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77
    What is The VK_Pause, We're suppose to write a program that exits when someone strikes the Break Key, and we don't know how to accomplish this.

  5. #5
    Unregistered
    Guest
    What you are looking for is Crtl-C in Windows. Check to see if the choice == EOF and break if so. That is the Break command in Windows. If you are checking Esc, test (choice == 27). This just will not work on some systems, but that is how you do it.

    e.g.

    if ((choice == 'q') || (choice == EOF) || ( choice == 27))
    {
    return 0;
    }


    good luck on finishing by 8:30.

    p.s. you shouldn't have dropped Discrete, lol

  6. #6
    Registered User SavesTheDay's Avatar
    Join Date
    Jan 2002
    Posts
    77
    dude! hahaha....i can't believe you read that this late....it's 2am and our programming is finally working....you gotta give me your e-mail addy and name so I can write you sometime....how did the Discrete test go for you? i sure enough dropped it like a *****...but enjoy the rest of the semester! my uark addy is ct***[email protected], drop me a line sometime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 16
    Last Post: 11-23-2007, 01:48 PM
  2. Virtual keys
    By Arkanos in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2005, 10:00 AM
  3. Directional Keys - Useing in Console
    By RoD in forum C++ Programming
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM
  4. FAQ: Directional Keys - Useing in Console
    By RoD in forum FAQ Board
    Replies: 38
    Last Post: 10-06-2002, 04:42 PM