Let's talk about the basic differences.
(1) getch () and getche () FunctionsBoth functions read one character from the keyboard. The call format is:Getch ();Getche ();The difference between the two is that the getch () function does not display
(1) getch () and getche () FunctionsBoth functions read one character from the keyboard. The call format is:Getch ()Getche ()The difference between the two is that the getch () function does not display the characters read back on the display screen
G ++ compile the program to import the getch () function, getch
Note: In ubuntu, G ++ compiles the C ++ program to import the getch () function (the program will continue to run only after a value is input by the standard function, no function
This article is for reprint article , document contributor Wdzhangxiang personal website: Www.baidu.com/p/wdzhangxiangFirst of all, don't forget to usegetch ()header file must be introducedconio.h, previously learned C language, we always like to
Introduction-Getch Brief IntroductionRefer to the old TC version getch description. (the article introduces a bit narrow, the application point is some dinosaur game era development details)#include /**/int __cdecl getch (void);Remember reading a
Getch ()
The header file: conio.h
function Purpose: Read a character from the console
Function prototype: int getch (void)
Return value: The character read
For example:
char ch; or int ch;
Getch (); or ch=getch ();
Use Getch (), wait for you
Getch ():
Header file: conio. h
Function purpose: Read a character from the console, but it is not displayed on the screen.
Function prototype: int getch (void)
Returned value: read characters
For example:
Char ch; or Int ch;
Getch (); or
The original: Getch () and GetChar () re-discussion In the C language character handler, Getch () and GetChar () are often confusing two functions, and they all have "strange" features that make beginners feel confused. There are a lot of
Original: Getch (), Getche (), and GetChar () functionsGetch (), Getche (), and GetChar () functions(1) Getch () and Getche () functionsBoth of these functions read a character from the keyboard. Its invocation format is:Getch ();Getche ();The
EOF
EOF (end of file) is a status returned by the file read operation. It is not a value read from the file, instead, it is a return value when the file reading function reads the end Of the file or cannot read down. The returned value is generally-1
Http://baike.baidu.com/view/675106.htm Getch ()
Header file: conio. h
Function purpose: Read a character from the console
Function prototype: int getch (void)
Returned value: read characters
For example:
Char ch; or Int ch;
Getch ();
Getch () ():
The header file: conio.h
function Purpose: Read a character from the console, but not on the screen
For example:
char ch; or int ch;
Getch () (); or Ch=getch () ();
Use Getch (), wait for you to press any key, then continue to
(1) getch () and getche () Functions
Both functions read one character from the keyboard. The call format is:
Getch ();
Getche ();
The difference between the two is that the getch () function does not display the characters read back on the display
GetChar is a library function in stdio.h that reads a character from the stdin stream, which means that if stdin has data, it can be read directly without input. The Getch () and Getche () are library functions in Conio.h, which is the function of
Function Name: getch ();Function: one character is not displayed on the console.Function Name: getchar ();Function: read characters from the stdin streamFunction Name: scanf ();Benefits:
Getchar has an int type return value. WhenProgramWhen
Getch (), getche (), and getchar () Functions
(1) getch () and getche () FunctionsBoth functions read one character from the keyboard. The call format is:Getch ();Getche ();The difference between the two is that the getch () function does not
GetChar () putchar (CH) scanf () header file stdio.hGetch () Getche () header file conio.hGets () puts () header file Stdio.h
both the Getch () and the Getche () functions read a character from the keyboard, However, the getch () function
Tan haoqiang's second version of C language design is not clear, or not.
I checked other information and finally figured it out.
Getch (), getche (), and getchar () Functions(1) getch () and getche () FunctionsBoth functions read one character from
How to Implement the getch () function and the getch FunctionTo use the getch () function, you must first introduce the conio. h header file.
However, I use cygwin as the compiling environment and cannot find conio. h. Therefore, I can only find an
The first thing to know: Getch and Getche is in conio.h this header file, but, but conio.h this file is not the C language standard library file, so under the Linux gcc is not this header file, and most of us use Getch and Getche function, because
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.