.\"Copyright 2010 (c) EPFL .TH XDF_OPEN 3 2010 "EPFL" "xdffileio library manual" .SH NAME xdf_open - Open a xDF file for reading or writing .SH SYNOPSIS .LP .B #include .sp .BI "struct xdf* xdf_open(const char* " filename ", int " mode "," .br .BI " enum xdffiletype " type ");" .br .SH DESCRIPTION .LP \fBxdf_open\fP() opens a xDF the file refered by the path \fIfilename\fP for reading or writing. .LP If \fImode\fP is \fBXDF_READ\fP, the file is opened for reading. Thus it must exist and \fItype\fP should be either \fBXDF_ANY\fP or set to the type of the file refered by \fItype\fP. Otherwise, the function will fail. .LP If \fImode\fP is \fBXDF_WRITE\fP, the file is opened for writing. Thus the path \fIfilename\fP must not refered to an existing file: the function will fail if the file exist. This behavior prevents to overwrite any previous recording. \fItype\fP should be also be set to the desired type of data format (\fBXDF_ANY\fP will result in a error). .LP The possible file type values are defined in the header file \fI\fP .SH "RETURN VALUE" .LP The function returns an handle to xDF file opened in case of success. Otherwise, NULL is returned and \fIerrno\fP is set appropriately. .SH ERRORS In addition to the errors related to calls to \fBopen\fP(3) or \fBread\fP(3), the following errors can occur: .TP 7 .B EILSEQ The file that is being opened does not correspond to a supported file format or is not of the type specified. .TP 7 .B ENOMEM The system is unable to allocate resources. .TP 7 .B EINVAL \fImode\fP is neither \fBXDF_READ\fP nor \fBXDF_WRITE\fP, or \fIfilename\fP is NULL. .SH "SEE ALSO" .BR xdf_close (3)