<!DOCTYPE html>
<html class="client-nojs vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-0 vector-toc-not-available vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-0 skin-theme-clientpref-os vector-sticky-header-enabled" lang="en" dir="ltr"><head>
    <meta charset="UTF-8">
    <title>Conio.h</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" type="image/png" href="./_res_/favicon.png">
    <link rel="canonical" href="https://en.wikipedia.org/wiki/Conio.h"> <link href="./_mw_/ext.cite.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/ext.pygments.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/ext.wikimediamessages.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.icons.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
    <link href="./_mw_/skins.vector.styles.css" rel="stylesheet" type="text/css">
    <meta name="ResourceLoaderDynamicStyles" content="">
    
    <link rel="stylesheet" type="text/css" href="./_mw_/site.styles.css">
    <link rel="stylesheet" type="text/css" href="./_mw_/noscript.css">
    <link rel="stylesheet" type="text/css" href="./_res_/footer.css">
    <link rel="stylesheet" type="text/css" href="./_res_/vector-2022.css">
  </head>
  <body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Conio_h rootpage-Conio_h skin-vector-2022 action-view">
    <div class="mw-page-container">
      <div class="mw-page-container-inner">
        <div class="mw-content-container">
          <main id="content" class="mw-body">
            <header class="mw-body-header vector-page-titlebar">
              <h1 id="firstHeading" class="firstHeading mw-first-heading">conio.h</h1>
            </header>
            <a id="top"></a>
            <div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
              <div id="contentSub">
                <div id="mw-content-subtitle"></div>
              </div>
              <div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<style data-mw-deduplicate="TemplateStyles:r1320445320">
/* start https://en.wikipedia.org/ */


.mw-parser-output .hatnote{font-style:italic}.mw-parser-output div.hatnote{padding-left:1.6em;margin-bottom:0.5em}.mw-parser-output .hatnote i{font-style:normal}.mw-parser-output .hatnote+link+.hatnote{margin-top:-0.5em}@media print{body.ns-0 .mw-parser-output .hatnote{display:none!important}}


/* end   https://en.wikipedia.org/ */
</style><div role="note" class="hatnote navigation-not-searchable">"Conio" redirects here. For the profanity, see <a href="https://en.wiktionary.org/wiki/co%C3%B1o" class="extiw external" title="wikt:coño">coño on Wiktionary</a>.</div>
<p><b>conio.h</b>  is a <a href="C_(programming_language)" title="C (programming language)">C</a> header file used mostly by <a href="MS-DOS" title="MS-DOS">MS-DOS</a> compilers to provide console <a href="C_file_input/output" title="C file input/output">input/output</a>.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>  It is not part of the <a href="C_standard_library" title="C standard library">C standard library</a> or <a href="ISO_C" class="mw-redirect" title="ISO C">ISO C</a>, nor is it defined by <a href="POSIX" title="POSIX">POSIX</a>.
</p><p>This header declares several useful library functions for performing "istream input and output" from a program. Most C compilers that target <a href="DOS" title="DOS">DOS</a>, <a href="Windows_3.x" title="Windows 3.x">Windows 3.x</a>, <a href="Phar_Lap_(company)" class="mw-redirect" title="Phar Lap (company)">Phar Lap</a>, DOSX, <a href="OS/2" title="OS/2">OS/2</a>, or <a href="Win32" class="mw-redirect" title="Win32">Win32</a><sup id="cite_ref-2" class="reference"><a href="#cite_note-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> have this header and supply the associated library functions in the default C library. Most C compilers that target <a href="UNIX" class="mw-redirect" title="UNIX">UNIX</a> and <a href="Linux" title="Linux">Linux</a> do not have this header and do not supply the library functions. Some embedded systems or <a href="Cc65" title="Cc65">cc65</a> use a conio-compatible library.<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p><p>The library functions declared by <style data-mw-deduplicate="TemplateStyles:r886049734">
/* start https://en.wikipedia.org/ */


.mw-parser-output .monospaced{font-family:monospace,monospace}


/* end   https://en.wikipedia.org/ */
</style><span class="monospaced">conio.h</span> vary somewhat from compiler to compiler. As originally implemented in <a href="Lattice_C" title="Lattice C">Lattice C</a>, the various functions mapped directly to few of the first <a href="DOS" title="DOS">DOS</a> <a href="INT_21H" class="mw-redirect" title="INT 21H">INT 21H</a> functions. The library supplied with <a href="Borland" title="Borland">Borland</a>'s <a href="Turbo_C" title="Turbo C">Turbo C</a> did not use the DOS API but instead accessed video RAM directly for output and used <a href="BIOS_interrupt_call" title="BIOS interrupt call">BIOS interrupt calls</a>. This library also has additional functions inspired from the successful <a href="Turbo_Pascal" title="Turbo Pascal">Turbo Pascal</a> one.
</p><p>Compilers that target non-DOS operating systems, such as <a href="Linux" title="Linux">Linux</a> or OS/2, provide similar solutions; the unix-related <a href="Curses_(programming_library)" title="Curses (programming library)">curses</a> library is very common here. Another example is <a href="SyncTERM#Libraries" class="mw-redirect" title="SyncTERM">SyncTERM's ciolib</a>. The version of <span class="monospaced">conio.h</span> done by <a href="DJ_Delorie" class="mw-redirect" title="DJ Delorie">DJ Delorie</a> for the <a href="GO32_(DOS_extender)" class="mw-redirect" title="GO32 (DOS extender)">GO32</a> extender is particularly extensive.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Functions">Functions</h2></div>
<table class="wikitable">
<tbody><tr>
<th>Name
</th>
<th>Description
</th></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">kbhit</code></td>
<td>Determines if a keyboard key was pressed as well
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">cgets</code></td>
<td>Reads a string directly from the console
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">cscanf</code></td>
<td>Reads formatted values directly from the console
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">putch</code></td>
<td>Writes a character directly to the console
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">cputs</code></td>
<td>Writes a string directly to the console
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">cprintf</code></td>
<td>Formats values and writes them directly to the console
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">clrscr</code></td>
<td>Clears the screen
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">getch</code></td>
<td>Get char entry from the console
</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">getche</code></td>
<td>Get char entry from the console with echo
</td></tr></tbody></table>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1327269900">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}body.skin-vector-2022 .mw-parser-output .reflist-columns-2{column-width:27em}body.skin-vector-2022 .mw-parser-output .reflist-columns-3{column-width:22.5em}.mw-parser-output .references[data-mw-group=upper-alpha]{list-style-type:upper-alpha}.mw-parser-output .references[data-mw-group=upper-roman]{list-style-type:upper-roman}.mw-parser-output .references[data-mw-group=lower-alpha]{list-style-type:lower-alpha}.mw-parser-output .references[data-mw-group=lower-greek]{list-style-type:lower-greek}.mw-parser-output .references[data-mw-group=lower-roman]{list-style-type:lower-roman}.mw-parser-output div.reflist-liststyle-upper-alpha .references{list-style-type:upper-alpha}.mw-parser-output div.reflist-liststyle-upper-roman .references{list-style-type:upper-roman}.mw-parser-output div.reflist-liststyle-lower-alpha .references{list-style-type:lower-alpha}.mw-parser-output div.reflist-liststyle-lower-greek .references{list-style-type:lower-greek}.mw-parser-output div.reflist-liststyle-lower-roman .references{list-style-type:lower-roman}


/* end   https://en.wikipedia.org/ */
</style><div>
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1333433106">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./_mw_/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./_mw_/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./_mw_/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./_mw_/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#bf3c2c)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#bf3c2c)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end   https://en.wikipedia.org/ */
</style><cite id="CITEREFSchildt1995" class="citation book cs1"><a href="Herbert_Schildt" title="Herbert Schildt">Schildt, Herbert</a> (1995). <i>C: The Complete Reference</i> (3rd&nbsp;ed.). Berkeley, Calif.: Osborne McGraw-Hill. p.&nbsp;288. <a href="ISBN_(identifier)" class="mw-redirect" title="ISBN (identifier)">ISBN</a>&nbsp;<bdi>0-07-882101-0</bdi>. <q>For DOS-compatible compilers, the direct console I/O functions generally use the CONIO.H header file.</q></cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=book&amp;rft.btitle=C%3A+The+Complete+Reference&amp;rft.place=Berkeley%2C+Calif.&amp;rft.pages=288&amp;rft.edition=3rd&amp;rft.pub=Osborne+McGraw-Hill&amp;rft.date=1995&amp;rft.isbn=0-07-882101-0&amp;rft.aulast=Schildt&amp;rft.aufirst=Herbert&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AConio.h" class="Z3988"></span></span>
</li>
<li id="cite_note-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-2">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://msdn.microsoft.com/en-us/library/7x2hy4cx(VS.71).aspx">"Console and Port I/O in MSDN"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=Console+and+Port+I%2FO+in+MSDN&amp;rft_id=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2F7x2hy4cx%28VS.71%29.aspx&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AConio.h" class="Z3988"></span></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://microvga.com/conio-lib">"MicroVGA conio Text User Interface Library"</a>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Abook&amp;rft.genre=unknown&amp;rft.btitle=MicroVGA+conio+Text+User+Interface+Library&amp;rft_id=http%3A%2F%2Fmicrovga.com%2Fconio-lib&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AConio.h" class="Z3988"></span></span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="http://www.delorie.com/djgpp/doc/libc/libc_4.html">"DJGPP C Library Reference – conio"</a>. <i>libc.a reference</i><span class="reference-accessdate">. Retrieved <span class="nowrap">January 22,</span> 2022</span>.</cite><span title="ctx_ver=Z39.88-2004&amp;rft_val_fmt=info%3Aofi%2Ffmt%3Akev%3Amtx%3Ajournal&amp;rft.genre=unknown&amp;rft.jtitle=libc.a+reference&amp;rft.atitle=DJGPP+C+Library+Reference+%E2%80%93+conio&amp;rft_id=http%3A%2F%2Fwww.delorie.com%2Fdjgpp%2Fdoc%2Flibc%2Flibc_4.html&amp;rfr_id=info%3Asid%2Fen.wikipedia.org%3AConio.h" class="Z3988"></span></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="https://msdn.microsoft.com/en-us/library/7x2hy4cx.aspx">Microsoft's documentation</a></li>
<li><a rel="nofollow" class="external text" href="http://www.digitalmars.com/rtl/conio.html">Digital Mars's documentation</a></li>
<li><a rel="nofollow" class="external text" href="http://www.lysator.liu.se/c/c-faq/c-16.html">IO FAQ</a> - explanation and suggestions for non-standard console IO</li>
<li><a rel="nofollow" class="external text" href="http://conio.sourceforge.net">Borland-style CONIO implementation for MinGW/Dev-C++</a></li>
<li><a rel="nofollow" class="external text" href="http://c-faq.com/osdep/cbreak.html">List of ways to get raw keyboard input</a></li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
    This article is issued from <a class="external text" title="Last edited on 2024-11-24" href="https://en.wikipedia.org/wiki/?title=Conio.h&amp;oldid=1259261596">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
            </div>
          </main>
        </div>
      </div>
    </div>
     <script src="./_webp_/webpHandler.js"></script>
  

</body></html>