fgetln(), fgetline()

get line from stream 

Function


SYNOPSIS

#include <stdio.h>

char *fgetln(FILE *stream, size_t *len);

char *fgetline(FILE *stream, size_t *len);


DESCRIPTION

The fgetln() function returns a pointer to the next line from the specified stream. This line is not a C string as it does not end with a terminating null character. The length of the line, including the final newline, is stored in the specified length location. Note that if the line is the last line of a file that does not end in a newline, the returned text does not contain a newline.

The fgetline() function is identical to fgetln().


PARAMETERS

stream 

Is stream from which the characters are read.

len 

Is the location in which the length of the line is stored.


RETURN VALUES

On success, a pointer is returned; this pointer becomes invalid after the next I/O operation on stream (whether successful or not) or as soon as the stream is closed. Otherwise, a null pointer is returned. The fgetln() function does not distinguish between end-of-file and error; the routines feof() and ferror() must be used to determine which occurred. If an error occurred, errno is set to one of the following values:

EACCES 

Another process has the file locked.

EBADF 

stream is not a valid stream opened for reading.

EINTR 

A signal interrupted the call.

EIO 

An input error occurred.

EISDIR 

The open object is a directory, not a file.

ENOMEM 

Memory could not be allocated for internal buffers.

ENXIO 

A device error occurred.

EWOULDBLOCK 

The underlying file descriptor is a non-blocking socket and no data is ready to be read.


CONFORMANCE

4.4BSD.


MULTITHREAD SAFETY LEVEL

MT-Safe.


PORTING ISSUES

For files opened in text-mode, the character sequence carriage-return linefeed is translated into linefeed. No such translation occurs for files opened in binary mode.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
feof(), ferror(), fgetc(), fgets(), fopen(), gets()


PTC MKS Toolkit 10.5 Documentation Build 40.