<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>Input Interface</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.18 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="modules.html">Modules</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> <a class="qindex" href="pages.html">Related Pages</a> <a class="qindex" href="examples.html">Examples</a> </center> <hr><h1>Input Interface</h1><table border=0 cellpadding=0 cellspacing=0> <tr><td></td></tr> <tr><td colspan=2><br><h2>Typedefs</h2></td></tr> <tr><td nowrap align=right valign=top>typedef _snd_input </td><td valign=bottom><a class="el" href="group___input.html#a0">snd_input_t</a></td></tr> <tr><td> </td><td><font size=-1><em>Internal structure for an input object.</em> <a href="#a0"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>typedef enum <a class="el" href="group___input.html#a10">_snd_input_type</a> </td><td valign=bottom><a class="el" href="group___input.html#a1">snd_input_type_t</a></td></tr> <tr><td colspan=2><br><h2>Enumerations</h2></td></tr> <tr><td nowrap align=right valign=top>enum </td><td valign=bottom><a class="el" href="group___input.html#a10">_snd_input_type</a> { <a class="el" href="group___input.html#a10a2">SND_INPUT_STDIO</a>, <a class="el" href="group___input.html#a10a3">SND_INPUT_BUFFER</a> }</td></tr> <tr><td colspan=2><br><h2>Functions</h2></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a2">snd_input_stdio_open</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> **inputp, const char *file, const char *mode)</td></tr> <tr><td> </td><td><font size=-1><em>Creates a new input object reading from a file.</em> <a href="#a2"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a3">snd_input_stdio_attach</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> **inputp, FILE *fp, int _close)</td></tr> <tr><td> </td><td><font size=-1><em>Creates a new input object using an existing stdio <code>FILE</code> pointer.</em> <a href="#a3"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a4">snd_input_buffer_open</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> **inputp, const char *buffer, ssize_t size)</td></tr> <tr><td> </td><td><font size=-1><em>Creates a new input object from a memory buffer.</em> <a href="#a4"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a5">snd_input_close</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> *input)</td></tr> <tr><td> </td><td><font size=-1><em>Closes an input handle.</em> <a href="#a5"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a6">snd_input_scanf</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> *input, const char *format,...)</td></tr> <tr><td> </td><td><font size=-1><em>Reads formatted input (like <code>fscanf(3))</code> from an input handle.</em> <a href="#a6"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>char * </td><td valign=bottom><a class="el" href="group___input.html#a7">snd_input_gets</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> *input, char *str, size_t size)</td></tr> <tr><td> </td><td><font size=-1><em>Reads a line from an input handle (like <code>fgets(3))</code>.</em> <a href="#a7"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a8">snd_input_getc</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> *input)</td></tr> <tr><td> </td><td><font size=-1><em>Reads a character from an input handle (like <code>fgetc(3))</code>.</em> <a href="#a8"></a><em></em></font><br><br></td></tr> <tr><td nowrap align=right valign=top>int </td><td valign=bottom><a class="el" href="group___input.html#a9">snd_input_ungetc</a> (<a class="el" href="group___input.html#a0">snd_input_t</a> *input, int c)</td></tr> <tr><td> </td><td><font size=-1><em>Puts the last character read back to an input handle (like <code>ungetc(3))</code>.</em> <a href="#a9"></a><em></em></font><br><br></td></tr> </table> <hr><a name="_details"></a><h2>Detailed Description</h2> The input functions present an interface similar to the stdio functions on top of different underlying input sources. <p> The <a class="el" href="conf_8c.html#a12">snd_config_load</a> function uses such an input handle to be able to load configurations not only from standard files but also from other sources, e.g. from memory buffers. <hr><h2>Typedef Documentation</h2> <a name="a0" doxytag="input.h::snd_input_t"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> typedef struct _snd_input snd_input_t </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Internal structure for an input object. <p> The ALSA library uses a pointer to this structure as a handle to an input object. Applications don't access its contents directly. </td> </tr> </table> <a name="a1" doxytag="input.h::snd_input_type_t"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> typedef enum <a class="el" href="group___input.html#a10">_snd_input_type</a> snd_input_type_t </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Input type. </td> </tr> </table> <hr><h2>Enumeration Type Documentation</h2> <a name="a10" doxytag="input.h::_snd_input_type"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> enum _snd_input_type </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Input type. <dl compact><dt><b>Enumeration values: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em><a name="a10a2" doxytag="SND_INPUT_STDIO"></a><em>SND_INPUT_STDIO</em></em> </td><td> Input from a stdio stream. </td></tr> <tr><td valign=top><em><a name="a10a3" doxytag="SND_INPUT_BUFFER"></a><em>SND_INPUT_BUFFER</em></em> </td><td> Input from a memory buffer. </td></tr> </table> </dl> </td> </tr> </table> <hr><h2>Function Documentation</h2> <a name="a4" doxytag="input.h::snd_input_buffer_open"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_buffer_open </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> ** </td> <td class="mdname" nowrap> <em>inputp</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>buf</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>ssize_t </td> <td class="mdname" nowrap> <em>size</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Creates a new input object from a memory buffer. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>inputp</em> </td><td> The function puts the pointer to the new input object at the address specified by <code>inputp</code>. </td></tr> <tr><td valign=top><em>buf</em> </td><td> Address of the input buffer. </td></tr> <tr><td valign=top><em>size</em> </td><td> Size of the input buffer. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> Zero if successful, otherwise a negative error code.</dl>This functions creates a copy of the input buffer, so the application is not required to preserve the buffer after this function has been called. </td> </tr> </table> <a name="a5" doxytag="input.h::snd_input_close"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_close </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> * </td> <td class="mdname1" valign="top" nowrap> <em>input</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Closes an input handle. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>input</em> </td><td> The input handle to be closed. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> Zero if successful, otherwise a negative error code. </dl> </td> </tr> </table> <a name="a8" doxytag="input.h::snd_input_getc"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_getc </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> * </td> <td class="mdname1" valign="top" nowrap> <em>input</em> </td> <td class="md" valign="top">) </td> <td class="md" nowrap></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Reads a character from an input handle (like <code>fgetc(3))</code>. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>input</em> </td><td> The input handle. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> The character read, or <code>EOF</code> on end of file or error. </dl> </td> </tr> </table> <a name="a7" doxytag="input.h::snd_input_gets"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> char* snd_input_gets </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> * </td> <td class="mdname" nowrap> <em>input</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>char * </td> <td class="mdname" nowrap> <em>str</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>size_t </td> <td class="mdname" nowrap> <em>size</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Reads a line from an input handle (like <code>fgets(3))</code>. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>input</em> </td><td> The input handle. </td></tr> <tr><td valign=top><em>str</em> </td><td> Address of the destination buffer. </td></tr> <tr><td valign=top><em>size</em> </td><td> The size of the destination buffer. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> Pointer to the buffer if successful, otherwise <code>NULL</code>.</dl>Like <code>fgets</code>, the returned string is zero-terminated, and contains the new-line character '<code>\n</code>' if the line fits into the buffer. </td> </tr> </table> <a name="a6" doxytag="input.h::snd_input_scanf"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_scanf </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> * </td> <td class="mdname" nowrap> <em>input</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>format</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>... </td> <td class="mdname" nowrap> </td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Reads formatted input (like <code>fscanf(3))</code> from an input handle. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>input</em> </td><td> The input handle. </td></tr> <tr><td valign=top><em>format</em> </td><td> Format string in <code>fscanf</code> format. </td></tr> <tr><td valign=top><em>...</em> </td><td> Other <code>fscanf</code> arguments. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> The number of input items assigned, or <code>EOF</code>.</dl><dl compact><dt><b><a class="el" href="bug.html#_bug000001">Bug: </a></b></dt><dd> Reading from a memory buffer doesn't work. </dl> </td> </tr> </table> <a name="a3" doxytag="input.h::snd_input_stdio_attach"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_stdio_attach </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> ** </td> <td class="mdname" nowrap> <em>inputp</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>FILE * </td> <td class="mdname" nowrap> <em>fp</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>_close</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Creates a new input object using an existing stdio <code>FILE</code> pointer. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>inputp</em> </td><td> The function puts the pointer to the new input object at the address specified by <code>inputp</code>. </td></tr> <tr><td valign=top><em>fp</em> </td><td> The <code>FILE</code> pointer to read from. Reading begins at the current file position. </td></tr> <tr><td valign=top><em>close</em> </td><td> Close flag. Set this to 1 if <a class="el" href="group___input.html#a5">snd_input_close</a> should close <code>fp</code> by calling <code>fclose</code>. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> Zero if successful, otherwise a negative error code. </dl> </td> </tr> </table> <a name="a2" doxytag="input.h::snd_input_stdio_open"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_stdio_open </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> ** </td> <td class="mdname" nowrap> <em>inputp</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>file</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>const char * </td> <td class="mdname" nowrap> <em>mode</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Creates a new input object reading from a file. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>inputp</em> </td><td> The functions puts the pointer to the new input object at the address specified by <code>inputp</code>. </td></tr> <tr><td valign=top><em>file</em> </td><td> The name of the file to read from. </td></tr> <tr><td valign=top><em>mode</em> </td><td> The open mode, like <code>fopen(3)</code>. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> Zero if successful, otherwise a negative error code. </dl> </td> </tr> </table> <a name="a9" doxytag="input.h::snd_input_ungetc"></a><p> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td class="md"> <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="md" nowrap valign="top"> int snd_input_ungetc </td> <td class="md" valign="top">( </td> <td class="md" nowrap valign="top"><a class="el" href="group___input.html#a0">snd_input_t</a> * </td> <td class="mdname" nowrap> <em>input</em>, </td> </tr> <tr> <td></td> <td></td> <td class="md" nowrap>int </td> <td class="mdname" nowrap> <em>c</em></td> </tr> <tr> <td></td> <td class="md">) </td> <td class="md" colspan="2"></td> </tr> </table> </td> </tr> </table> <table cellspacing=5 cellpadding=0 border=0> <tr> <td> </td> <td> <p> Puts the last character read back to an input handle (like <code>ungetc(3))</code>. <p> <dl compact><dt><b>Parameters: </b></dt><dd> <table border=0 cellspacing=2 cellpadding=0> <tr><td valign=top><em>input</em> </td><td> The input handle. </td></tr> <tr><td valign=top><em>c</em> </td><td> The character to push back. </td></tr> </table> </dl><dl compact><dt><b>Returns: </b></dt><dd> The character pushed back, or <code>EOF</code> on error. </dl> </td> </tr> </table> <hr><address style="align: right;"><small>Generated on Wed Apr 2 16:06:36 2003 for ALSA project - the C library reference by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.18 </small></address> </body> </html>