getch()和getchar()

一、函数名: getch                |        函数名: getchar
功  能: 从控制台无回显地取一个字符        |        功  能: 从stdin流中读字符
用  法: int getch(void);                                     |        用  法: int getchar(void);
程序例:                     |        程序例:
#include <stdio.h>                |        #include <stdio.h>
#include <conio.h>                |        
int main(void)                  |        int main(void)
{                         |        {
   char ch;                    |        int c;
   printf("Input a character:");          |        /* 注意,从stdin和行缓冲中读取来获取字符,直到你按回车,否则它不会返回. */
   ch = getche();                |        while ((c = getchar()) != ' ')  
   printf(" You input a '%c' ", ch);       |          printf("%c", c);
   return 0;                    |        return 0;
}                         |        }

#-----------------------------------------  这些是注释  -----------------------------------------#

conio.h不是C标准库中的头文件。
conio是Console Input/Output(控制台输入输出)的简写,其中定义了通过控制台进行数据输入和数据输出的函数,主要是一些用户通过按键盘产生的对应操作,比如getch()函数等等。
包含的函数
cgets(char *);
cprintf(const char *, ...);
cputs(const char *);
cscanf(const char *, ...);  ……  [详见,百度知道的参考链接:  https://zhidao.baidu.com/question/82874213.html  -- "在c语言里#include<conio.h>是什么样的头文件,包含哪些函数?"]

#-----------------------------------------  注释已结束  -----------------------------------------#

原文地址:https://www.cnblogs.com/mybo/p/6526375.html