A device detection library that is used natively or by 51Degrees products

TextFile

Detailed Description

Contains helper methods for accessing and using text files.

This is of most use in unit tests and examples, where text files containing sample data are used.

Collaboration diagram for TextFile:

Functions

void fiftyoneDegreesTextFileIterateWithLimit (const char *fileName, char *buffer, int length, int limit, void *state, void(*callback)(const char *, void *))
 Iterates over all the lines in a text file up to the given limit number of line to read, calling the callback method with each line.
void fiftyoneDegreesTextFileIterate (const char *fileName, char *buffer, int length, void *state, void(*callback)(const char *, void *))
 Iterates over all the lines in a text file calling the callback method with each line.

Function Documentation

◆ fiftyoneDegreesTextFileIterate()

void fiftyoneDegreesTextFileIterate ( const char * fileName,
char * buffer,
int length,
void * state,
void(* callback )(const char *, void *) )

Iterates over all the lines in a text file calling the callback method with each line.

Parameters
fileNamename of the file to iterate over
bufferto use for reading lines into. The buffer needs to be big enough to hold the biggest record, including its line ending.
lengthof the buffer
statepointer to pass to the callback method
callbackmethod to call with each line

◆ fiftyoneDegreesTextFileIterateWithLimit()

void fiftyoneDegreesTextFileIterateWithLimit ( const char * fileName,
char * buffer,
int length,
int limit,
void * state,
void(* callback )(const char *, void *) )

Iterates over all the lines in a text file up to the given limit number of line to read, calling the callback method with each line.

Parameters
fileNamename of the file to iterate over
bufferto use for reading lines into. The buffer needs to be big enough to hold the biggest record, including its line ending.
lengthof the buffer
limitnumber of lines to read. -1 for read all.
statepointer to pass to the callback method
callbackmethod to call with each line