Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

xdf_open(3) [debian man page]

XDF_OPEN(3)						     xdffileio library manual						       XDF_OPEN(3)

NAME
xdf_open - 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 for- mat (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. SEE ALSO
xdf_close(3) EPFL
2010 XDF_OPEN(3)

Check Out this Related Man Page

XDF_READ(3)						     xdffileio library manual						       XDF_READ(3)

NAME
xdf_read - Read samples from a xDF file SYNOPSIS
#include <xdfio.h> int xdf_read(struct xdf* xdf, unsigned int ns, ...); DESCRIPTION
xdf_read() reads ns samples from the xDF file referenced by xdf. This file should have been opened with mode XDF_READ and xdf_pre- pare_arrays(3) should have been successfully called on it. xdf_read() will fail otherwise). The data to be read will be transferred into arrays specified by pointers provided in the variable list of arguments of the function. The function expects the same number of arrays as specified by previous call to xdf_define_arrays(3). The internal organisation of the data in the arrays should have been specified previously with calls to xdf_set_chconf(3). In addition, it is important to note that none of the arrays should overlap. RETURN VALUE
The function returns the number of the samples successfully read from the xDF file in case of success. The number of samples read can be smaller than the number requested in the end of the file is reached. In case of error, -1 is returned and errno is set appropriately. ERRORS
EINVAL xdf is NULL EPERM No successfull call to xdf_prepare_transfer(3) have been done on xdf or it has been opened using the mode XDF_WRITE. EINTR The call was interrupted by a signal before any data was written; see signal(7). EIO A low-level I/O error occurred while reading from the inode. ESTALE Stale file handle. This error can occur for NFS and for other file systems EXAMPLE
/* Assume xdf references a xDF file opened for reading whose channels source their data in 2 arrays of float whose strides are the length of respectively 4 and 6 float values, i.e. 16 and 24 bytes (in most platforms)*/ #define NS 3 float array1[NS][4], array2[NS][6]; unsigned int strides = {4*sizeof(float), 6*sizeof(float)}; unsigned int i; xdf_define_arrays(xdf, 2, strides); if (xdf_prepare_transfer(xdf)) return 1; for (i=0; i<45; i+=NS) { /* Write the values to the file */ if (xdf_write(xdf, NS, array1, array2)) return 1; /* Use the values contained in array1 and array2*/ ... } xdf_close(xdf); SEE ALSO
xdf_set_chconf(3), xdf_define_arrays(3), xdf_prepare_transfer(3) EPFL
2010 XDF_READ(3)
Man Page