Conio.h explained

conio.h is a C header file used mostly by MS-DOS compilers to provide console input/output.[1] It is not part of the C standard library or ISO C, nor is it defined by POSIX.

This header declares several useful library functions for performing "istream input and output" from a program. Most C compilers that target DOS, Windows 3.x, Phar Lap, DOSX, OS/2, or Win32[2] have this header and supply the associated library functions in the default C library. Most C compilers that target UNIX and Linux do not have this header and do not supply the library functions. Some embedded systems or cc65 use a conio-compatible library.[3]

The library functions declared by vary somewhat from compiler to compiler. As originally implemented in Lattice C, the various functions mapped directly to the first few DOS INT 21H functions. The library supplied with Borland's Turbo C did not use the DOS API but instead accessed video RAM directly for output and used BIOS interrupt calls. This library also has additional functions inspired from the successful Turbo Pascal one.

Compilers that target non-DOS operating systems, such as Linux or OS/2, provide similar solutions; the unix-related curses library is very common here. Another example is SyncTERM's ciolib. The version of done by DJ Delorie for the GO32 extender is particularly extensive.[4]

Functions

Determines if a keyboard key was pressed as well
Reads a string directly from the console
Reads formatted values directly from the console
Writes a character directly to the console
Writes a string directly to the console
Formats values and writes them directly to the console
Clears the screen
Get char entry from the console
Get char entry from the console with buffer

External links

Notes and References

  1. Book: Schildt, Herbert . Herbert Schildt

    . C: The Complete Reference . Osborne McGraw-Hill . 1995 . 0-07-882101-0 . 3rd . Berkeley, Calif. . 288 . en-US . For DOS-compatible compilers, the direct console I/O functions generally use the CONIO.H header file. . Herbert Schildt.

  2. Web site: Console and Port I/O in MSDN.
  3. Web site: MicroVGA conio Text User Interface Library.
  4. Web site: DJGPP C Library Reference – conio . January 22, 2022 . libc.a reference . en-US.