1<html lang="en"> 2<head> 3<title>Stdio - Untitled</title> 4<meta http-equiv="Content-Type" content="text/html"> 5<meta name="description" content="Untitled"> 6<meta name="generator" content="makeinfo 4.13"> 7<link title="Top" rel="start" href="index.html#Top"> 8<link rel="prev" href="Ctype.html#Ctype" title="Ctype"> 9<link rel="next" href="Strings.html#Strings" title="Strings"> 10<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 11<meta http-equiv="Content-Style-Type" content="text/css"> 12<style type="text/css"><!-- 13 pre.display { font-family:inherit } 14 pre.format { font-family:inherit } 15 pre.smalldisplay { font-family:inherit; font-size:smaller } 16 pre.smallformat { font-family:inherit; font-size:smaller } 17 pre.smallexample { font-size:smaller } 18 pre.smalllisp { font-size:smaller } 19 span.sc { font-variant:small-caps } 20 span.roman { font-family:serif; font-weight:normal; } 21 span.sansserif { font-family:sans-serif; font-weight:normal; } 22--></style> 23<link rel="stylesheet" type="text/css" href="../cs.css"> 24</head> 25<body> 26<div class="node"> 27<a name="Stdio"></a> 28<p> 29Next: <a rel="next" accesskey="n" href="Strings.html#Strings">Strings</a>, 30Previous: <a rel="previous" accesskey="p" href="Ctype.html#Ctype">Ctype</a>, 31Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> 32<hr> 33</div> 34 35<h2 class="chapter">4 Input and Output (<samp><span class="file">stdio.h</span></samp>)</h2> 36 37<p>This chapter comprises functions to manage files 38or other input/output streams. Among these functions are subroutines 39to generate or scan strings according to specifications from a format string. 40 41 <p>The underlying facilities for input and output depend on the host 42system, but these functions provide a uniform interface. 43 44 <p>The corresponding declarations are in <samp><span class="file">stdio.h</span></samp>. 45 46 <p>The reentrant versions of these functions use macros 47 48<pre class="example"> _stdin_r(<var>reent</var>) 49 _stdout_r(<var>reent</var>) 50 _stderr_r(<var>reent</var>) 51</pre> 52 <p class="noindent">instead of the globals <code>stdin</code>, <code>stdout</code>, and 53<code>stderr</code>. The argument <[reent]> is a pointer to a reentrancy 54structure. 55 56<ul class="menu"> 57<li><a accesskey="1" href="clearerr.html#clearerr">clearerr</a>: Clear file or stream error indicator 58<li><a accesskey="2" href="diprintf.html#diprintf">diprintf</a>: Print to a file descriptor (integer only) 59<li><a accesskey="3" href="dprintf.html#dprintf">dprintf</a>: Print to a file descriptor 60<li><a accesskey="4" href="fclose.html#fclose">fclose</a>: Close a file 61<li><a accesskey="5" href="fcloseall.html#fcloseall">fcloseall</a>: Close all files 62<li><a accesskey="6" href="fdopen.html#fdopen">fdopen</a>: Turn an open file into a stream 63<li><a accesskey="7" href="feof.html#feof">feof</a>: Test for end of file 64<li><a accesskey="8" href="ferror.html#ferror">ferror</a>: Test whether read/write error has occurred 65<li><a accesskey="9" href="fflush.html#fflush">fflush</a>: Flush buffered file output 66<li><a href="fgetc.html#fgetc">fgetc</a>: Get a character from a file or stream 67<li><a href="fgetpos.html#fgetpos">fgetpos</a>: Record position in a stream or file 68<li><a href="fgets.html#fgets">fgets</a>: Get character string from a file or stream 69<li><a href="fgetwc.html#fgetwc">fgetwc</a>: Get a wide character from a file or stream 70<li><a href="fgetws.html#fgetws">fgetws</a>: Get a wide character string from a file or stream 71<li><a href="fileno.html#fileno">fileno</a>: Get file descriptor associated with stream 72<li><a href="fmemopen.html#fmemopen">fmemopen</a>: Open a stream around a fixed-length buffer 73<li><a href="fopen.html#fopen">fopen</a>: Open a file 74<li><a href="fopencookie.html#fopencookie">fopencookie</a>: Open a stream with custom callbacks 75<li><a href="fpurge.html#fpurge">fpurge</a>: Discard all pending I/O on a stream 76<li><a href="fputc.html#fputc">fputc</a>: Write a character on a stream or file 77<li><a href="fputs.html#fputs">fputs</a>: Write a character string in a file or stream 78<li><a href="fputwc.html#fputwc">fputwc</a>: Write a wide character to a file or stream 79<li><a href="fputws.html#fputws">fputws</a>: Write a wide character string to a file or stream 80<li><a href="fread.html#fread">fread</a>: Read array elements from a file 81<li><a href="freopen.html#freopen">freopen</a>: Open a file using an existing file descriptor 82<li><a href="fseek.html#fseek">fseek</a>: Set file position 83<li><a href="fsetpos.html#fsetpos">fsetpos</a>: Restore position of a stream or file 84<li><a href="ftell.html#ftell">ftell</a>: Return position in a stream or file 85<li><a href="funopen.html#funopen">funopen</a>: Open a stream with custom callbacks 86<li><a href="fwide.html#fwide">fwide</a>: Set and determine the orientation of a FILE stream 87<li><a href="fwrite.html#fwrite">fwrite</a>: Write array elements from memory to a file or stream 88<li><a href="getc.html#getc">getc</a>: Get a character from a file or stream (macro) 89<li><a href="getc_005funlocked.html#getc_005funlocked">getc_unlocked</a>: Get a character from a file or stream (macro) 90<li><a href="getchar.html#getchar">getchar</a>: Get a character from standard input (macro) 91<li><a href="getchar_005funlocked.html#getchar_005funlocked">getchar_unlocked</a>: Get a character from standard input (macro) 92<li><a href="getdelim.html#getdelim">getdelim</a>: Get character string from a file or stream 93<li><a href="getline.html#getline">getline</a>: Get character string from a file or stream 94<li><a href="gets.html#gets">gets</a>: Get character string from standard input (obsolete) 95<li><a href="getw.html#getw">getw</a>: Get a word (int) from a file or stream 96<li><a href="getwchar.html#getwchar">getwchar</a>: Get a wide character from standard input 97<li><a href="mktemp.html#mktemp">mktemp</a>: Generate unused file name 98<li><a href="open_005fmemstream.html#open_005fmemstream">open_memstream</a>: Open a write stream around an arbitrary-length buffer 99<li><a href="perror.html#perror">perror</a>: Print an error message on standard error 100<li><a href="putc.html#putc">putc</a>: Write a character on a stream or file (macro) 101<li><a href="putc_005funlocked.html#putc_005funlocked">putc_unlocked</a>: Write a character on a stream or file (macro) 102<li><a href="putchar.html#putchar">putchar</a>: Write a character on standard output (macro) 103<li><a href="putchar_005funlocked.html#putchar_005funlocked">putchar_unlocked</a>: Write a character on standard output (macro) 104<li><a href="puts.html#puts">puts</a>: Write a character string on standard output 105<li><a href="putw.html#putw">putw</a>: Write a word (int) to a file or stream 106<li><a href="putwchar.html#putwchar">putwchar</a>: Write a wide character to standard output 107<li><a href="remove.html#remove">remove</a>: Delete a file's name 108<li><a href="rename.html#rename">rename</a>: Rename a file 109<li><a href="rewind.html#rewind">rewind</a>: Reinitialize a file or stream 110<li><a href="setbuf.html#setbuf">setbuf</a>: Specify full buffering for a file or stream 111<li><a href="setbuffer.html#setbuffer">setbuffer</a>: Specify full buffering for a file or stream with size 112<li><a href="setlinebuf.html#setlinebuf">setlinebuf</a>: Specify line buffering for a file or stream 113<li><a href="setvbuf.html#setvbuf">setvbuf</a>: Specify buffering for a file or stream 114<li><a href="siprintf.html#siprintf">siprintf</a>: Write formatted output (integer only) 115<li><a href="siscanf.html#siscanf">siscanf</a>: Scan and format input (integer only) 116<li><a href="sprintf.html#sprintf">sprintf</a>: Write formatted output 117<li><a href="sscanf.html#sscanf">sscanf</a>: Scan and format input 118<li><a href="swprintf.html#swprintf">swprintf</a>: Write formatted wide character output 119<li><a href="swscanf.html#swscanf">swscanf</a>: Scan and format wide character input 120<li><a href="tmpfile.html#tmpfile">tmpfile</a>: Create a temporary file 121<li><a href="tmpnam.html#tmpnam">tmpnam</a>: Generate name for a temporary file 122<li><a href="ungetc.html#ungetc">ungetc</a>: Push data back into a stream 123<li><a href="ungetwc.html#ungetwc">ungetwc</a>: Push wide character data back into a stream 124<li><a href="vfprintf.html#vfprintf">vfprintf</a>: Format variable argument list 125<li><a href="vfscanf.html#vfscanf">vfscanf</a>: Scan variable argument list 126<li><a href="vfwprintf.html#vfwprintf">vfwprintf</a>: Format variable wide character argument list 127<li><a href="vfwscanf.html#vfwscanf">vfwscanf</a>: Scan and format argument list from wide character input 128<li><a href="viprintf.html#viprintf">viprintf</a>: Format variable argument list (integer only) 129<li><a href="viscanf.html#viscanf">viscanf</a>: Scan variable format list (integer only) 130</ul> 131 132 </body></html> 133 134