Character Manipulation Function
size_t getline(char **lineptr, size_t *n, FILE *stream);
Internationalization (I18n) Function Overview
The getline function reads an entire line from stream , storing the
text (including the newline and a terminating null character) in a buffer and storing the buffer
address in *lineptr . It also sets the integer pointed to by n to the
number of characters stored in the buffer. If *lineptr is NULL and
*n is 0 , then the function will perform a malloc to
allocate the memory needed for the buffer, and will set the variables accordingly. The function
will also do a realloc if the passed in buffer is not large enough.
When getline is successful, it returns the number of characters read (including the
newline, but not including the terminating null). This value enables you to distinguish null
characters that are part of the line from the null character inserted as a terminator.
In the event of an error, it returns -1.
I18n Issues
getline works with UTF-8 multibyte data; there is no wide-character version of the function.
On ANSI UTF-16 platforms, use a conversion function to convert the
buffer returned from getline to a wide-character string.
See Character I/O for a discussion on non-ASCII character
input/output in an internationalized application.
Recommended Replacements*
*If you're already using the recommended function, see I18n Issues for other reasons why Globalyzer is detecting the function.
Character Manipulation Functions
|