Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages  

file_api.h File Reference

File input/output API. More...

#include <comprex.h>

Go to the source code of this file.

Functions

CxFilecxOpenFile (const char *path, CxAccessMode mode)
 Opens a file from a local or remote filesystem, or in an archive.

void cxCloseFile (CxFile *file)
 Closes a file.

size_t cxRead (void *ptr, size_t size, size_t nmemb, CxFile *file)
 Reads data from a file.

size_t cxWrite (const void *ptr, size_t size, size_t nmemb, CxFile *file)
 Writes data to a file.

void cxClearErr (CxFile *file)
 Clears the error flag and end-of-file indicator.

int cxEof (CxFile *file)
 Tests the end-of-file indicator.

int cxError (CxFile *file)
 Tests the error indicator of the file.

const char * cxStrError (CxFile *file, int errnum)
 Returns a string representation of the error.


Detailed Description

File input/output API.

Id:
file_api.h,v 1.4 2001/12/31 09:25:20 chipx86 Exp
Copyright:
(C) 2001-2002 The GNUpdate Project.
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details.

You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


Function Documentation

void cxClearErr CxFile   file
 

Clears the error flag and end-of-file indicator.

Parameters:
file  The file.

void cxCloseFile CxFile   file
 

Closes a file.

The CxFile structure will be deleted after this is called.

Parameters:
file  The file to close.

int cxEof CxFile   file
 

Tests the end-of-file indicator.

Parameters:
file  The file.
Returns:
1 if the end-of-file indicator is set; 0 otherwise.

int cxError CxFile   file
 

Tests the error indicator of the file.

Parameters:
file  The file.
Returns:
The error if set, or 0 on no error.

CxFile* cxOpenFile const char *    path,
CxAccessMode    mode
 

Opens a file from a local or remote filesystem, or in an archive.

Parameters:
path  The path to the file.
mode  The access mode.
Returns:
The file, if it exists. NULL otherwise.

size_t cxRead void *    ptr,
size_t    size,
size_t    nmemb,
CxFile   file
 

Reads data from a file.

Parameters:
ptr  The buffer which will store the data.
size  The size of an element of data.
nmemb  The number of elements of size @size to receive.
file  The file to read from.
Returns:
The number of elements read, or 0 on error or end of file.

const char* cxStrError CxFile   file,
int    errnum
 

Returns a string representation of the error.

Parameters:
file  The associated file.
errnum  The error number.
Returns:
The string representation of the error.

size_t cxWrite const void *    ptr,
size_t    size,
size_t    nmemb,
CxFile   file
 

Writes data to a file.

Parameters:
ptr  The data to write.
size  The size of an element of data.
nmemb  The number of elements of size @size to receive.
file  The file to write to.
Returns:
The number of elements written, or 0 on error.


Generated on Wed May 29 12:20:35 2002 for libcomprex by doxygen1.2.15-20020430