Unit 'AmigaDOS' Package
[Overview][Constants][Types][Procedures and functions][Variables][Index] [#morphunits]

FGets

Reads a line from the specified input (buffered)

Declaration

Source position: amigados.pas line 1857

function FGets(

  fh: LongInt;

  buf: PChar;

  buflen: Cardinal

):PChar;

Arguments

fh

  

filehandle to use for buffered I/O

buf

  

Area to read bytes into.

buflen

  

Number of bytes to read, must be > 0.

Function result

Pointer to buffer passed in, or nil for immediate EOF or for an error. If nil is returnd for an EOF, IoErr() will return 0.

Description

This routine reads in a single line from the specified input stopping at a NEWLINE character or EOF. In either event, UP TO the number of len specified bytes minus 1 will be copied into the buffer. Hence if a length of 50 is passed and the input line is longer than 49 bytes, it will return 49 characters. It returns the buffer pointer normally, or NULL if EOF is the first thing read.

If terminated by a newline, the newline WILL be the last character in the buffer. This is a buffered read routine. The string read in IS null-terminated.

See also

FRead

  

Reads a number of blocks from an input (buffered)

FPuts

  

Writes a string the the specified output

FGetC

  

Read a character from the specified input (buffered)


Documentation generated on: 2021-07-30