OpenDiskStream()
SeekDiskStream()
ReadDiskStream()
CloseDiskStream()
Stream *OpenDiskStream( char *theName, int32 bSize )
OpenDiskStream()
opens the file identified by an absolute or relative pathname, allocates the specified amount of buffer space, and initiates an asynchronous read to fill the buffer with the first portion of the file's data. It returns NULL if any of these functions cannot be performed for any reason.
ReadDiskStream()
int32 ReadDiskStream( Stream *theStream, char *buffer, int32 nBytes )
ReadDiskStream()
reads data from the given stream file starting at the current position within the file. The data is put into the supplied buffer. The number of bytes actually read from the file is returned. The position within the file is advanced by the number of bytes read, so that the next time ReadDiskStream()
is called, the data that follows is read.
SeekDiskStream( Stream *thream, int32 offset, enum SeekOrigin whence )
SeekDiskStream()
, data transfers start with the first byte at the new file position. The whence
argument specifies whether the operation is relative to either the beginning or end of the file, or to the current position in the file. The offset
argument specifies the number of bytes offset relative to the whence
position. It returns the actual absolute file position that results from the seek position or a negative error code if unsuccessful.
The offset can be specified in any of three ways: absolute (positive) byte offset from the beginning of file (SEEK_SET
), relative byte offset from the current position in the file (SEEK_CUR
), or absolute (negative) byte offset from the end of the file (SEEK_END
).
CloseDiskStream()
closes the stream's file, deallocates the buffer memory, and releases the stream structure.
void CloseDiskStream(Stream *theStream);