rfile
rfile - RIFFIOFile routines
.
Return a pointer to a new RIFFIOFile,
or null on failure
RIFFIOFile *
RIFFIOFileNew(void)
The file cannot be operated on until
RIFFIOFileInit()
is called.
Provide a NIFFIOFile with a user-defined I/O callbacks.
RIFFIOSuccess
RIFFIOFileInit(RIFFIOFile *prf,
void *pvUserFile,
RIFFIOReader reader,
RIFFIOWriter writer,
RIFFIOSeeker seeker,
RIFFIOTeller teller)
RIFFFIOFileInit() should be called immediately after NIFFIOFileNew()
-
*<prf>
-
is the RIFFIOFile that is being initialized.
-
*<pvUserFile>
-
points to a user representation of a file that will be passed to
user-defined reader, writer, seeker, and teller functions.
-
*<reader>,<writer>,<seeker>,<teller>
-
are user-defined functions that perform operations on <*pvUserFile>.
.
Free the memory allocated to a RIFFIOFile.
void
RIFFIOFileDelete(RIFFIOFile *prf)
Return the form type (UNKNOWN, RIFF, or RIFX)
of a RIFFIOFile
RIFFIOFormType
RIFFIOFileGetFormType(RIFFIOFile *prf)
The form type is unknown until the first form chunk of a RIFFIOFile
is descended into or created.
Read bytes from a RIFF file.
long
RIFFIORead(RIFFIOFile *prf, void *pvBuffer, long nBytes)
T <*pvBuffer> must be allocated to hold <nBytes>.
- Up to <nBytes> have been read from <*prf> into <*pvBuffer>.
.
- The number of bytes actually read,
- 0 on end of file,
- -1 on error.
.
Write bytes to a RIFF file.
long
RIFFIOWrite(RIFFIOFile *prf, void *pvBuffer, long nBytes)
Write <nBytes> from <*pvBuffer> to <*prf>.
The number of bytes actually written.
Seek to a location in a RIFF file.
RIFFIOSuccess
RIFFIOSeek(RIFFIOFile *prf, RIFFIOOffset offset, RIFFIOSeekOrigin origin)
Seek <offset> bytes relative to <origin>.
RIFFIO_SEEK_SET:
beginning of file
RIFFIO_SEEK_CUR:
current file position
RIFFIO_SEEK_END:
end of file
On failure, the file position is undefined.
Return the current RIFF file position.
long
RIFFIOTell(RIFFIOFile *prf)
A file's position is measured in bytes from the
beginning of the file.