Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

fp.h File Reference

File Pointers. More...

Go to the source code of this file.

Data Structures

struct  _CxFP
 A file pointer. More...


Typedefs

typedef _CxFP CxFP
 A file pointer.


Functions

CxFPcxNewFp (void)
 Creates a file pointer structure.

void cxSetFpAccessMode (CxFP *fp, CxAccessMode mode)
 Sets the access mode of the specified file pointer.

void cxSetReadFunc (CxFP *fp, size_t(*fnc)(void *, size_t, size_t, CxFP *))
 Sets the read function for this file pointer.

void cxSetWriteFunc (CxFP *fp, size_t(*fnc)(const void *, size_t, size_t, CxFP *))
 Sets the write function for this file pointer.

void cxSetSeekFunc (CxFP *fp, void(*fnc)(CxFP *, long, int))
 Sets the seek function for this file pointer.

void cxSetCloseFunc (CxFP *fp, void(*fnc)(CxFP *))
 Sets the close function for this file pointer.

void cxSetError (CxFP *fp, int errnum, const char *errstr)
 Sets the current error number and string.

CxAccessMode cxGetFpAccessMode (CxFP *fp)
 Returns the access mode of the specified file pointer.


Detailed Description

File Pointers.

Copyright:
(C) 2001-2003 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.


Typedef Documentation

typedef struct _CxFP CxFP
 

A file pointer.


Function Documentation

CxAccessMode cxGetFpAccessMode CxFP   fp
 

Returns the access mode of the specified file pointer.

Parameters:
fp The file pointer.
Returns:
The file's access mode.
See also:
cxSetFpAccessMode()

CxFP* cxNewFp void   
 

Creates a file pointer structure.

Returns:
A new file pointer structure.
See also:
cxClose()

void cxSetCloseFunc CxFP   fp,
void(*    fnc)(CxFP *)
 

Sets the close function for this file pointer.

This should destroy the module-specific content associated with this file pointer in the moduleData variable.

This function must be in the following format:

 void closeFunction(CxFP *fp)
 {
     ...
 }
 

The name of the function can be changed, of course.

Parameters:
fp The file pointer.
fnc The close function.
See also:
cxSetReadFunc()

cxSetSeekFunc()

cxSetWriteFunc()

void cxSetError CxFP   fp,
int    errnum,
const char *    errstr
 

Sets the current error number and string.

Parameters:
fp The file pointer.
errnum The error number.
errstr The error string.

void cxSetFpAccessMode CxFP   fp,
CxAccessMode    mode
 

Sets the access mode of the specified file pointer.

Parameters:
fp The file pointer.
mode The access mode.
See also:
cxGetFpAccessMode()

void cxSetReadFunc CxFP   fp,
size_t(*    fnc)(void *, size_t, size_t, CxFP *)
 

Sets the read function for this file pointer.

This should work just like libc's fread() function, but with a CxFP instead of a FILE. It must read from the file stored in the archive.

This function must be in the following format:

 size_t readFunction(void *ptr, size_t size, size_t nmemb, CxFP *fp)
 {
     ...
 }
 

The name of the function can be changed, of course.

Parameters:
fp The file pointer.
fnc The read function.
See also:
cxSetCloseFunc()

cxSetSeekFunc()

cxSetWriteFunc()

void cxSetSeekFunc CxFP   fp,
void(*    fnc)(CxFP *, long, int)
 

Sets the seek function for this file pointer.

This should work just like libc's fseek() function, but with a CxFP instead of a FILE. It must seek to the specified location in the file.

This function must be in the following format:

 void seekFunction(CxFP *fp, long offset, int whence)
 {
     ...
 }
 

The name of the function can be changed, of course.

Parameters:
fp The file pointer.
fnc The seek function.
See also:
cxSetCloseFunc()

cxSetReadFunc()

cxSetWriteFunc()

void cxSetWriteFunc CxFP   fp,
size_t(*    fnc)(const void *, size_t, size_t, CxFP *)
 

Sets the write function for this file pointer.

This should work just like libc's fwrite() function, but with a CxFP instead of a FILE. It must write to the file stored in the archive.

This function must be in the following format:

 size_t writeFunction(const void *ptr, size_t size, size_t nmemb, CxFP *fp)
 {
     ...
 }
 

The name of the function can be changed, of course.

Parameters:
fp The file pointer.
fnc The write function.
See also:
cxSetCloseFunc()

cxSetReadFunc()

cxSetSeekFunc()


Generated on Wed Mar 5 20:47:44 2003 for libcomprex by doxygen1.2.18-20021020