struct xdf* xdf_open(const char* filename, int mode,
enum xdffiletype type);
xdf_open() opens a xDF the file refered by the path filename for reading or writing.
If mode is XDF_READ, the file is opened for reading. Thus it must exist and type should be either XDF_ANY or set to the type of the file refered by type. Otherwise, the function will fail.
If mode is XDF_WRITE, the file is opened for writing. Thus the path filename must not refered to an existing file: the function will fail if the file exist. This behavior prevents to overwrite any previous recording. type should be also be set to the desired type of data format (XDF_ANY will result in a error).
The possible file type values are defined in the header file <xdfio.h>
The function returns an handle to xDF file opened in case of success. Otherwise, NULL is returned and errno is set appropriately.
ERRORSIn addition to the errors related to calls to open(3) or read(3), the following errors can occur:
- The file that is being opened does not correspond to a supported file format or is not of the type specified.
- The system is unable to allocate resources.
- mode is neither XDF_READ nor XDF_WRITE, or filename is NULL.