BSKStream
Defined in: bskstream.h
The BSKStream object encapsulates stream I/O, whether it be from a file
or a buffer in memory. If other streams are needed as well, it would
not be difficult to make a new stream object (see bskstream.c for more
info).
A BSKStream object has the following methods:
- BSKI32 close( BSKStream* stream ) - closes (and disposes of) the
stream. The given stream object is no longer valid after the
stream is closed. The method returns 0 on success.
- BSKI32 read( BSKStream* stream, BSKNOTYPE buffer, BSKUI32 len ) -
reads up to 'len' bytes from 'stream' and puts them in 'buffer'.
The method returns the number of bytes read, or -1 if there
was an error, or the end of file was reached before any bytes
could be read.
- BSKI32 write( BSKStream* stream, BSKNOTYPE buffer, BSKUI32 len ) -
writes len bytes to stream from buffer. The method returns the
number of bytes actually written.
- BSKI32 getch( BSKStream* stream ) - returns the next character on
the stream, or -1 if there was an error or EOF was reached.
- BSKI32 putch( BSKStream* stream, BSKI32 c ) - puts the character c
back into the stream, making it the character that will be
read by the next call to getch. Returns 0 if successful.
Any new stream object must define all these methods.
Data types:
Functions:
Return to API
Last updated on 8 Feb 2001 by Jamis Buck (minam@rpgplanet.com)