C 非标准库(conio.h)

  • 所谓的 C 标准库(C standard library),是指在 ISO C 或者 POSIX 标准中定义的;
    • POSIX is a superset(超集) of the standard C library, and it’s important to note that it defers to it. If C and POSIX is ever in conflict, C wins.

1. conio.h

conio 是 Console Input/Output (控制台输入输出)的简写。大部分DOS,Windows 3.x,Phar Lap,DOSX,OS/2 or Win32 平台上的 C 编译器提供此文件,UNIX 和 Linux 平台的 c 编译器通常不包含此头文件。

conio 库不仅适用于 Windows 平台,在 Linux 下也可使用,网上已经有兼容包,下载后打开就可使用;而至于Mac的os X中提供的Xcode却并不支持这一函数库。

常用函数:

  • getch()/_getch()

    带下划线_的函数一般是函数库内部的函数,而不带下划线的一般是提供给用户使用的函数。带下划线的目的是为了防止用户定义的函数和函数库的函数重名冲突,所以直接使用也是可以的。要用getch()必须引入头文件conio.h。

    _getch() 和 getch() 及 _T()

原文地址:https://www.cnblogs.com/mtcnn/p/9421258.html