\r\n

51Degrees Device Detection C/C++  4.2Newer Version 4.3

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. More...
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. More...

Function Documentation

◆ fiftyoneDegreesTextFileIterate()

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

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

Parameters
fileName - name of the file to iterate over
buffer - to use for reading lines into. The buffer needs to be big enough to hold the biggest record, including its line ending.
length - of the buffer
state - pointer to pass to the callback method
callback - method to call with each line
Examples
Hash/OfflineProcessing.c.

◆ fiftyoneDegreesTextFileIterateWithLimit()

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

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
fileName - name of the file to iterate over
buffer - to use for reading lines into. The buffer needs to be big enough to hold the biggest record, including its line ending.
length - of the buffer
limit - number of lines to read. -1 for read all.
state - pointer to pass to the callback method
callback - method to call with each line
On This Page