Key Difference – getchvs getche
A program gets the input from the user and does some kind of processing on that data and outputs the result. Input and Output functions are the links between the user and the terminal. InC programming language, there are number of input functions and output functions provided by the language. Two such functions are getch and getche. Thekey difference在Getch和Getche之间,是,Getchis used to read a single character from the keyboard which does not display the entered value on screen and does not wait for the enter key whereas getche is used to read a single character from the keyboard which displays immediately on screen without waiting for the enter key.This article discusses the difference between the two functions getch and getche.
内容
1.Overview and Key Difference
2.什么是Getch
3.什么是Getche
4.Getch和Getche之间的相似之处
5.Side by Side Comparison – getch vs getche in Tabular Form
6.概括
什么是Getch?
Getchis used to read a single character from the keyboard. The reading does not display on the screen. The entered character is immediately returned without waiting for the enter key.
Getchwill read the user entered value but it does not display that on the screen. When the user gives an input character, it does not display on the screen and without waiting for the enter key, the output ofprintf将显示在下一个位置的屏幕上。它仅由于printf函数而显示。
根据上面的程序中,一个角色是意图d using getch function. It does not display the received value on the screen and does not wait till the enter key is pressed. Here, the input character ‘y’ is given. It does not display on the screen and does not wait till the enter key is pressed. The ‘y’ value is displayed because of the putchar function.
什么是Getche?
Getche function is used to read a single character from the keyboard. The reading is displayed immediately on the screen without waiting for the enter key.
根据上面的程序中,一个角色是意图d using getche function. It displays the received value on the screen. It does not wait till the enter key is pressed. When giving the input ‘a’, it is displayed on the screen. It does not wait till the enter key is pressed. The second ‘a’ value is displayed on the screen because of the putchar function.
What are the Similarities Between getch and getche?
- Both are functions provided by the C language.
- Does not wait till the enter key is pressed.
What is the Difference Between getch and getche?
Getchvs getche |
|
Getch是C函数,可以从键盘上读取单个字符,该字符在屏幕上不显示并立即返回而无需等待Enter键。 | Getche is a C function to read a single character from the keyboard which displays immediately on screen without waiting for the enter key. |
Input Displaying Method | |
Getch不显示用户输入的字符。 | Getche显示用户输入的字符。 |
Syntax | |
Getch语法类似于int getch(void); | getche语法类似于int getche(void); |
摘要 - Getchvs getche
Getchand getche are functions in C language. The difference between getch and getche is that, getch is used to read a single character from the keyboard which does not display the entered value on screen and does not wait for the enter key ; getche is used to read a single character from the keyboard which displays immediately on screen without waiting for the enter key. The getch and getche appear to be same but they are different.
Download the PDF Version of getch vs getche
You can download PDF version of this article and use it for offline purposes as per citation note. Please download PDF version hereDifference Between getch and getche
Reference:
- mahajancomputerskkr. YouTube, YouTube, 31 Jan. 2014.Available here
- Ashim Lamichhane, Project Manager at Kath Codex Follow. “Unit 3. Input and Output.” LinkedIn SlideShare, 29 Feb. 2016.Available here
发表评论