BRender Technical Reference Manual:4 Data Structures (Alphabetical Reference):brfile_getline_cbfn
Next|Prev|Up
The Call-Back Function
Specification
CBFnFileGetLine()

brfile_getline_cbfn


The Call-Back Function

This type defines a get line function, primarily intended for the getline member of the br_filesystem
125 structure.

The typedef

(See brfile.h for a precise declaration)

br_size_t brfile_getline_cbfn(char*,br_size_t,void*) Getline

Specification


CBFnFileGetLine()

Description:
An application defined call-back function reading a line of text (excluding terminators) from a file.

Declaration:
br_size_t BR_CALLBACK CBFnFileGetLine(char* buf, br_size_t buf_len, void* f)

Arguments:
char * buf

Buffer to hold text read.

br_size_t buf_len

Length of buffer (maximum number of characters to store - including `\0').

void * f

Valid file handle - as returned by CBFnFileOpenRead()376.

Preconditions:
BRender has completed initialisation. BRender is the only direct caller of this function.

Effects:
Read characters into supplied buffer until buf_len-1 characters have been read, end of line has been read, or end of file has been reached. If the last character read was `\n' it is removed from the buffer.

Result:
br_size_t

The number of characters stored in the buffer is returned. If at the end of file upon entry, zero will be returned.

Example:
See stdfile.c for examples of filing system functions.



Generated with CERN WebMaker