| <html lang="en"> |
| <head> |
| <title>getdelim - Untitled</title> |
| <meta http-equiv="Content-Type" content="text/html"> |
| <meta name="description" content="Untitled"> |
| <meta name="generator" content="makeinfo 4.13"> |
| <link title="Top" rel="start" href="index.html#Top"> |
| <link rel="up" href="Stdio.html#Stdio" title="Stdio"> |
| <link rel="prev" href="getchar_005funlocked.html#getchar_005funlocked" title="getchar_unlocked"> |
| <link rel="next" href="getline.html#getline" title="getline"> |
| <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> |
| <meta http-equiv="Content-Style-Type" content="text/css"> |
| <style type="text/css"><!-- |
| pre.display { font-family:inherit } |
| pre.format { font-family:inherit } |
| pre.smalldisplay { font-family:inherit; font-size:smaller } |
| pre.smallformat { font-family:inherit; font-size:smaller } |
| pre.smallexample { font-size:smaller } |
| pre.smalllisp { font-size:smaller } |
| span.sc { font-variant:small-caps } |
| span.roman { font-family:serif; font-weight:normal; } |
| span.sansserif { font-family:sans-serif; font-weight:normal; } |
| --></style> |
| </head> |
| <body> |
| <div class="node"> |
| <a name="getdelim"></a> |
| <p> |
| Next: <a rel="next" accesskey="n" href="getline.html#getline">getline</a>, |
| Previous: <a rel="previous" accesskey="p" href="getchar_005funlocked.html#getchar_005funlocked">getchar_unlocked</a>, |
| Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> |
| <hr> |
| </div> |
| |
| <h3 class="section">4.36 <code>getdelim</code>—read a line up to a specified line delimiter</h3> |
| |
| <p><a name="index-getdelim-223"></a><strong>Synopsis</strong> |
| <pre class="example"> #include <stdio.h> |
| int getdelim(char **<var>bufptr</var>, size_t *<var>n</var>, |
| int <var>delim</var>, FILE *<var>fp</var>); |
| |
| </pre> |
| <p><strong>Description</strong><br> |
| <code>getdelim</code> reads a file <var>fp</var> up to and possibly including a specified |
| delimiter <var>delim</var>. The line is read into a buffer pointed to |
| by <var>bufptr</var> and designated with size *<var>n</var>. If the buffer is |
| not large enough, it will be dynamically grown by <code>getdelim</code>. |
| As the buffer is grown, the pointer to the size <var>n</var> will be |
| updated. |
| |
| <p><br> |
| <strong>Returns</strong><br> |
| <code>getdelim</code> returns <code>-1</code> if no characters were successfully read; |
| otherwise, it returns the number of bytes successfully read. |
| At end of file, the result is nonzero. |
| |
| <p><br> |
| <strong>Portability</strong><br> |
| <code>getdelim</code> is a glibc extension. |
| |
| <p>No supporting OS subroutines are directly required. |
| |
| <p><br> |
| |
| </body></html> |
| |