<!DOCTYPE html>
<html class="client-js"><head>
  <meta charset="UTF-8">
  <title>conio.h</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script>
    function importScript() { return 1 } // this is to avoid the error from site.js
  </script>
  <script>let articleId = 'Conio.h'</script>
  <link rel="canonical" href="https://en.wikipedia.org/wiki/Conio.h">
  <link href="../-/mw/ext.cite.ux-enhancements.css" rel="stylesheet" type="text/css">
<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/skins.minerva.base.reset|skins.minerva.content.styles|ext.cite.style|site.styles|mobile.app.pagestyles.android|mediawiki.page.gallery.styles|mediawiki.skinning.content.parsoid.css" rel="stylesheet" type="text/css">
  <link href="../-/style.css" rel="stylesheet" type="text/css"><link href="../-/content.parsoid.css" rel="stylesheet" type="text/css"><link href="../-/inserted_style.css" rel="stylesheet" type="text/css">
  <script src="../-/script.js"></script><script src="../-/masonry.min.js"></script><script src="../-/article_list_home.js"></script><script src="../-/images_loaded.min.js"></script><script src="../-/node_module/details-element-polyfill/dist/details-element-polyfill.js"></script>
</head>

<body class="mediawiki mw-hide-empty-elt ns-0 ns-subject stable skin-minerva action-view animations">
  <div id="mw-mf-viewport" class="feature-header-v2">
    <div id="mw-mf-page-center">
      <div id="content" class="mw-body">
        <a id="top"></a>
        <div id="bodyContent" class="content mw-parser-output">
          
          <div id="mw-content-text" style="direction: ltr;"><h1 class="section-heading" tabindex="0" aria-haspopup="true" data-section-id="0">
  <span class="mw-headline" id="title_0">conio.h</span>
</h1>
<div id="mf-section-0" class="mf-section-0" aria-pressed="true" aria-expanded="true">
  <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>.<span class="mw-ref reference" id="cite_ref-1"><a href="#cite_note-1" style="counter-reset: mw-Ref 1;"><span class="mw-reflink-text">[1]</span></a></span>  It is not part of the <a href="C_standard_library" title="C standard library">C standard library</a> or <a href="ISO_C" title="ISO C" class="mw-redirect">ISO C</a>, nor is it defined by <a href="POSIX" title="POSIX">POSIX</a>.</p>

<div role="note" class="hatnote navigation-not-searchable">"Conio" redirects here. For the profanity, see <a href="https://en.wiktionary.org/wiki/coño" title="wikt:coño" class="external">coño on Wiktionary</a>.</div>
<p><span>
</span><meta property="mw:PageProp/displaytitle" content="conio.h"></p>

<p>This header declares several useful library functions for performing "console 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)" title="Phar Lap (company)">Phar Lap</a>, DOSX, <a href="OS/2" title="OS/2">OS/2</a>, or Win32<span class="mw-ref reference" id="cite_ref-2"><a href="#cite_note-2" style="counter-reset: mw-Ref 2;"><span class="mw-reflink-text">[2]</span></a></span> have this header and supply the associated library functions in the default C library. Most C compilers that target <a href="UNIX" title="UNIX" class="mw-redirect">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.<span class="mw-ref reference" id="cite_ref-3"><a href="#cite_note-3" style="counter-reset: mw-Ref 3;"><span class="mw-reflink-text">[3]</span></a></span></p>

<p>The library functions declared by <style data-mw-deduplicate="TemplateStyles:r886049734">.mw-parser-output .monospaced{font-family:monospace,monospace}</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 the first few <a href="DOS" title="DOS">DOS</a> <a href="INT_21H" title="INT 21H" class="mw-redirect">INT 21H</a> functions. The library supplied with <a href="Borland" title="Borland">Borland</a>'s <a href="Turbo_C" title="Turbo C" class="mw-redirect">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" title="SyncTERM" class="mw-redirect">SyncTERM's ciolib</a>. The version of <span class="monospaced">conio.h</span> done by <a href="DJ_Delorie" title="DJ Delorie" class="mw-redirect">DJ Delorie</a> for the <a href="GO32_(DOS_extender)" title="GO32 (DOS extender)" class="mw-redirect">GO32</a> extender is particularly extensive.<span class="mw-ref reference" id="cite_ref-4"><a href="#cite_note-4" style="counter-reset: mw-Ref 4;"><span class="mw-reflink-text">[4]</span></a></span></p>


</div><details data-level="2" open="">
    <summary class="section-heading"><h2 id="Member_functions">Member functions</h2></summary>
    
<table class="wiitable">
<tbody><tr><td><code class="mw-highlight mw-highlight-lang-text" style="" dir="ltr">kbhit</code></td><td>Determines if a keyboard key was pressed</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text" 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" 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" 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" 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" 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" style="" dir="ltr">clrscr</code></td><td>Clears the screen</td></tr>
<tr>
<td><code class="mw-highlight mw-highlight-lang-text" style="" dir="ltr">getch</code></td><td>Get char entry from the console</td></tr>
</tbody></table>


    
</details><details data-level="2" open="">
    <summary class="section-heading"><h2 id="References">References</h2></summary>
    
<div class="reflist " style=" list-style-type: decimal;">
<div class="mw-references-wrap"><ol class="mw-references references"><li id="cite_note-1"> <span id="mw-reference-text-cite_note-1" class="mw-reference-text"><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<span>&nbsp;</span>ed.). Berkeley, Calif.: Osborne McGraw-Hill. p.<span>&nbsp;</span>288. <a href="ISBN_(identifier)" title="ISBN (identifier)" class="mw-redirect">ISBN</a><span>&nbsp;</span><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></li><li id="cite_note-2"> <span id="mw-reference-text-cite_note-2" class="mw-reference-text"><cite class="citation web cs1"><a href="http://msdn.microsoft.com/en-us/library/7x2hy4cx(VS.71).aspx" class="external text external">"Console and Port I/O in MSDN"</a>.</cite></span></li><li id="cite_note-3"> <span id="mw-reference-text-cite_note-3" class="mw-reference-text"><cite class="citation web cs1"><a href="http://jioplans4u.com/" class="external text external">"MicroVGA conio Text User Interface Library"</a>.</cite></span></li><li id="cite_note-4"> <span id="mw-reference-text-cite_note-4" class="mw-reference-text"><cite class="citation web cs1"><a href="http://www.delorie.com/djgpp/doc/libc/libc_4.html" class="external text external">"DJGPP C Library Reference – conio"</a>.</cite></span></li></ol></div></div>


    
</details><details data-level="2" open="">
    <summary class="section-heading"><h2 id="External_links">External links</h2></summary>
    

<ul><li><a href="https://msdn.microsoft.com/en-us/library/7x2hy4cx.aspx" class="external text external">Microsoft's documentation</a></li>
<li><a href="http://www.digitalmars.com/rtl/conio.html" class="external text external">Digital Mars's documentation</a></li>
<li><a href="http://www.lysator.liu.se/c/c-faq/c-16.html" class="external text external">IO FAQ</a> - explanation and suggestions for non-standard console IO</li>
<li><a href="http://conio.sourceforge.net" class="external text external">Borland-style CONIO implementation for MinGW/Dev-C++</a></li>
<li><a href="http://c-faq.com/osdep/cbreak.html" class="external text external">List of ways to get raw keyboard input</a></li>
<li><a href="https://decodediary.com/2018/09/05/use-of-header-file-in-c" class="external text external">Use of header file in c programs</a></li></ul>







<style data-mw-deduplicate="TemplateStyles:r999302996">.mw-parser-output cite.citation{font-style:inherit}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .id-lock-free a,.mw-parser-output .citation .cs1-lock-free a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/6/65/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited a,.mw-parser-output .id-lock-registration a,.mw-parser-output .citation .cs1-lock-limited a,.mw-parser-output .citation .cs1-lock-registration a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/d/d6/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription a,.mw-parser-output .citation .cs1-lock-subscription a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/a/aa/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-subscription,.mw-parser-output .cs1-registration{color:#555}.mw-parser-output .cs1-subscription span,.mw-parser-output .cs1-registration span{border-bottom:1px dotted;cursor:help}.mw-parser-output .cs1-ws-icon a{background:linear-gradient(transparent,transparent),url("//upload.wikimedia.org/wikipedia/commons/4/4c/Wikisource-logo.svg")right 0.1em center/12px no-repeat}.mw-parser-output code.cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;font-size:100%}.mw-parser-output .cs1-visible-error{font-size:100%}.mw-parser-output .cs1-maint{display:none;color:#33aa33;margin-left:0.3em}.mw-parser-output .cs1-format{font-size:95%}.mw-parser-output .cs1-kern-left,.mw-parser-output .cs1-kern-wl-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right,.mw-parser-output .cs1-kern-wl-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}</style>
    
</details><!--htdig_noindex--><div><div style="clear:both; background-image:linear-gradient(180deg, #E8E8E8, white); border-top: dashed 2px #AAAAAA; padding: 0.5em 0.5em 0.5em 0.5em; margin-top: 1em; direction: ltr;">
    This article is issued from <a class="external text" title="Last edited on 2020-12-13" href="https://en.wikipedia.org/wiki/?title=Conio.h&amp;oldid=993935584">Wikipedia</a>. The text is licensed under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons - Attribution - Sharealike</a>. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
        </div>
      </div>
    </div>
  </div>
  <script src="../-/mw/jsConfigVars.js"></script>
  <script src="../-/mw/startup.js"></script>
<script src="../-/mw/jquery.js"></script>
<script src="../-/mw/mediawiki.js"></script>
<script src="../-/mw/site.js"></script>
<script src="../-/mw/ext.cite.ux-enhancements.js"></script>



</body></html>