1<html lang="en"> 2<head> 3<title>getdelim - 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="up" href="Stdio.html#Stdio" title="Stdio"> 9<link rel="prev" href="getchar_005funlocked.html#getchar_005funlocked" title="getchar_unlocked"> 10<link rel="next" href="getline.html#getline" title="getline"> 11<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> 12<meta http-equiv="Content-Style-Type" content="text/css"> 13<style type="text/css"><!-- 14 pre.display { font-family:inherit } 15 pre.format { font-family:inherit } 16 pre.smalldisplay { font-family:inherit; font-size:smaller } 17 pre.smallformat { font-family:inherit; font-size:smaller } 18 pre.smallexample { font-size:smaller } 19 pre.smalllisp { font-size:smaller } 20 span.sc { font-variant:small-caps } 21 span.roman { font-family:serif; font-weight:normal; } 22 span.sansserif { font-family:sans-serif; font-weight:normal; } 23--></style> 24<link rel="stylesheet" type="text/css" href="../cs.css"> 25</head> 26<body> 27<div class="node"> 28<a name="getdelim"></a> 29<p> 30Next: <a rel="next" accesskey="n" href="getline.html#getline">getline</a>, 31Previous: <a rel="previous" accesskey="p" href="getchar_005funlocked.html#getchar_005funlocked">getchar_unlocked</a>, 32Up: <a rel="up" accesskey="u" href="Stdio.html#Stdio">Stdio</a> 33<hr> 34</div> 35 36<h3 class="section">4.36 <code>getdelim</code>—read a line up to a specified line delimiter</h3> 37 38<p><a name="index-getdelim-223"></a><strong>Synopsis</strong> 39<pre class="example"> #include <stdio.h> 40 int getdelim(char **<var>bufptr</var>, size_t *<var>n</var>, 41 int <var>delim</var>, FILE *<var>fp</var>); 42 43</pre> 44 <p><strong>Description</strong><br> 45<code>getdelim</code> reads a file <var>fp</var> up to and possibly including a specified 46delimiter <var>delim</var>. The line is read into a buffer pointed to 47by <var>bufptr</var> and designated with size *<var>n</var>. If the buffer is 48not large enough, it will be dynamically grown by <code>getdelim</code>. 49As the buffer is grown, the pointer to the size <var>n</var> will be 50updated. 51 52 <p><br> 53<strong>Returns</strong><br> 54<code>getdelim</code> returns <code>-1</code> if no characters were successfully read; 55otherwise, it returns the number of bytes successfully read. 56At end of file, the result is nonzero. 57 58 <p><br> 59<strong>Portability</strong><br> 60<code>getdelim</code> is a glibc extension. 61 62 <p>No supporting OS subroutines are directly required. 63 64 <p><br> 65 66 </body></html> 67 68