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

brfile_open_read_cbfn


The Call-Back Function

This type defines a stream advance function, primarily intended for the open_read member of the br_filesystem
125 structure.

The typedef

(See brfile.h for a precise declaration)

void* brfile_open_read_cbfn(const char*, br_size_t, br_mode_test_cbfn*, int*)

Specification


CBFnFileOpenRead()

Description:
An application defined call-back function to open a file for read access.

Declaration:
void* BR_CALLBACK CBFnFileOpenRead(const char* name, br_size_t n_magics, br_mode_test_cbfn* mode_test, int* mode_result)

Arguments:
const char * name

Name of file.

br_size_t n_magics

Number of characters required for mode_test to determine file type (less than or equal to BR_MAX_FILE_MAGICS).

br_mode_test_cbfn mode_test

Call-back function that can be used to determine file type given the first n_magics characters of a file. Will not be used if Null.

int * mode_result

If this argument is non-Null, the file type (if it could be determined) will be stored at the address pointed to.

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

Effects:
Searches for a file called name, if no path is specified with the file, looks in the current directory, if not found tries, in order, the directories listed in BRENDER_PATH (if defined). Having found the file, use mode_test (if supplied) to find out if the file is text, binary or unknown. Store the result through mode_result (if non-Null). Obtain a handle to the file.

Result:
void *

Return a file handle or Null if the file could not be opened.

Remarks:
Text mode files are primarily used for debugging but can be useful to allow hand editing of input data.

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



Generated with
CERN WebMaker