HALFRED  0.4.0
Functions
IOFile interface

Detailed Description

Overview.

The file-based IODevice, fetches data from an input file and writes output to an output file. It is provided mainly for testing purposes.

Creating and destroying file-based IODevices.

All file-based IODevice objects are created at runtime, by a call to IOFILE_Create function. This call allocates memory for a new IODevice descriptor (plus additional memory for file info) and associates it with two distinct file: input and output. Such IODevice is then ready to operate as a regular IODevice object. If the input_file_name was NULL, then the resulting IODevice will be write-only. If the output_file_name was NULL, the resulting IODevice will be read-only. When done using, all file-based IODevices should be destroyed to free allocated memory, by a call to IOFILE_Destroy function.

Using file-based IODevices.

At the time of creation, none of the file handling operations are executed. The associated files are not opened, until a call to IODEV_Init. IODEV_Deinit closes the files.

Functions

IODevice IOFILE_Create (const char *input_file_name, const char *output_file_name)
 
void IOFILE_Destroy (IODevice iodevice)
 

Function Documentation

IODevice IOFILE_Create ( const char *  input_file_name,
const char *  output_file_name 
)

Creates a new IODevice, that reads and writes to files.

Parameters
input_file_namename of the file, that the new IODevice will read from (input data stream) or NULL if the device is write-only
output_file_namename of the file, that the new IODevice will write to (output data stream) or NULL if the device is read-only
Returns
new file-based IODevice handle or NULL if creation failed
void IOFILE_Destroy ( IODevice  iodevice)

Destroys a file-based IODevice and frees all memory allocated for it. Note, that this function should NOT be used to free other types of IODevices.

Parameters
iodevicefile-based IODevice handle