World Library  
Flag as Inappropriate
Email this Article

Conio.h

Article Id: WHEBN0007416511
Reproduction Date:

Title: Conio.h  
Author: World Heritage Encyclopedia
Language: English
Subject: Cc65, Text mode, C headers, Text user interface, SMG$
Collection: C Headers, Conio, Text Mode, Text User Interface, Text User Interface Libraries
Publisher: World Heritage Encyclopedia
Publication
Date:
 

Conio.h

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 "console 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 use a conio-compatible library.[3]

The library functions declared by conio.h 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 conio.h done by DJ Delorie for the GO32 extender is particularly extensive.[4]

Member functions
  • kbhit - Determines if a keyboard key was pressed.
  • getch - Reads a character directly from the console without buffer, and without echo.
  • getche - Reads a character directly from the console without buffer, but with echo.
  • ungetch - Puts the character c back into the keyboard buffers.
  • cgets - Reads a string directly from the console.
  • cscanf - Reads formatted values directly from the console.
  • putch - Writes a character directly to the console.
  • cputs - Writes a string directly to the console.
  • cprintf - Formats values and writes them directly to the console.
  • clrscr - Clears the screen.

Compilers provided later than 1989 have prepended an _ to the names, to comply with the requisites of the ANSI C Standard.

References

  1. ^  
  2. ^ "Console and Port I/O in MSDN". 
  3. ^ "MicroVGA conio Text User Interface Library". 
  4. ^ "DJGPP C Library Reference – conio". 

External links

  • Digital Mars's documentation
  • IO FAQ - explanation and suggestions for non-standard console IO
  • Borland-style CONIO implementation for MinGW/Dev-C++
  • List of ways to get raw keyboard input
This article was sourced from Creative Commons Attribution-ShareAlike License; additional terms may apply. World Heritage Encyclopedia content is assembled from numerous content providers, Open Access Publishing, and in compliance with The Fair Access to Science and Technology Research Act (FASTR), Wikimedia Foundation, Inc., Public Library of Science, The Encyclopedia of Life, Open Book Publishers (OBP), PubMed, U.S. National Library of Medicine, National Center for Biotechnology Information, U.S. National Library of Medicine, National Institutes of Health (NIH), U.S. Department of Health & Human Services, and USA.gov, which sources content from all federal, state, local, tribal, and territorial government publication portals (.gov, .mil, .edu). Funding for USA.gov and content contributors is made possible from the U.S. Congress, E-Government Act of 2002.
 
Crowd sourced content that is contributed to World Heritage Encyclopedia is peer reviewed and edited by our editorial staff to ensure quality scholarly research articles.
 
By using this site, you agree to the Terms of Use and Privacy Policy. World Heritage Encyclopedia™ is a registered trademark of the World Public Library Association, a non-profit organization.
 



Copyright © World Library Foundation. All rights reserved. eBooks from World eBook Library are sponsored by the World Library Foundation,
a 501c(4) Member's Support Non-Profit Organization, and is NOT affiliated with any governmental agency or department.