RAD Studio |  |

getch

Header File

conio.h

Category

Console I/O Routines

Prototype

int getch(void);

Description

Gets character from keyboard, does not echo to screen.

getch reads a single character directly from the keyboard, without echoing to the screen.

Note: Do not use this function in Win32 GUI applications.
Return Value

getch returns the character read from the keyboard.

Example

Copy Code

    #include <conio.h>
    #include <stdio.h>
    int main(void)
    {
      int c;
      int extended = 0;
      c = getch();
      if (!c)
        extended = getch();
      if (extended)
        printf("The character is extended\n");
      else
        printf("The character isn't extended\n");
      return 0;
    }

Portability

POSIX | Win32 | ANSI C | ANSI C++
| + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!