xdf_open(3) Open a xDF file for reading or writing

SYNOPSIS

#include <xdfio.h>

struct xdf* xdf_open(const char* filename, int mode,
enum xdffiletype type);

DESCRIPTION

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>

RETURN VALUE

The function returns an handle to xDF file opened in case of success. Otherwise, NULL is returned and errno is set appropriately.

ERRORS

In addition to the errors related to calls to open(3) or read(3), the following errors can occur:
EILSEQ
The file that is being opened does not correspond to a supported file format or is not of the type specified.
ENOMEM
The system is unable to allocate resources.
EINVAL
mode is neither XDF_READ nor XDF_WRITE, or filename is NULL.