Next: , Previous: Simple Output, Up: C-Style I/O Functions


16.2.3 Line-Oriented Input

— Built-in Function: fgetl (fid, len)

Read characters from a file, stopping after a newline, or EOF, or len characters have been read. The characters read, excluding the possible trailing newline, are returned as a string.

If len is omitted, fgetl reads until the next newline character.

If there are no more characters to read, fgetl returns −1.

     
     
See also: fread, fscanf.

— Built-in Function: fgets (fid, len)

Read characters from a file, stopping after a newline, or EOF, or len characters have been read. The characters read, including the possible trailing newline, are returned as a string.

If len is omitted, fgets reads until the next newline character.

If there are no more characters to read, fgets returns −1.

     
     
See also: fread, fscanf.