home *** CD-ROM | disk | FTP | other *** search
-
- BINIO routines
- --------------------------------------------------------------------------
- The BINIO routines provide input and output access to files.
- BINIO stands for 'BINary Input and Output'. Binary meaning any type
- of file. The BINIO functions will be familiar to many programmers.
-
-
- BINIO Programming Interface
- --------------------------------------------------------------------------
-
- Constants
- -----------------------------------------------------------------------
- BINIO_OPEN_READ - open for read access only
- BINIO_OPEN_WRITE - open for read and write access
- BINIO_OPEN_CREATE - create file and open with read and write access
- BINIO_SEEK_SET - seek from beginning of file
- BINIO_SEEK_CUR - seek from current file pointer position
- BINIO_SEEK_SET - seek from end of file
-
-
- binio_open(name, mode)
- -----------------------------------------------------------------------
- PURPOSE:
- Open a file.
-
- PARAMETERS:
-
- name
- name of file to open
-
- mode
- open mode (one of BINIO_OPEN_*)
-
- RETURN VALUE:
-
- -1
- could not open file
-
- else
- handle to opened file
-
- NOTES:
- The file pointer is set to 0 for all opened files.
-
-
- binio_close(handle)
- -----------------------------------------------------------------------
- PURPOSE:
- Close a file opened with binio_open.
-
- PARAMETERS:
-
- handle
- handle to opened file (from binio_open)
-
-
- RETURN VALUE:
-
- -1
- could not close file
-
- 0
- file was successfully closed
-
-
- binio_read(handle, buffer, bytes)
- -----------------------------------------------------------------------
- PURPOSE:
- Read data from a file, at the current file pointer position.
-
- PARAMETERS:
-
- handle
- handle to opened file (from binio_open)
-
- buffer
- memory buffer where data will be placed
-
- bytes
- bytes to read (0-65534)
-
-
- RETURN VALUE (32 bit integer):
-
- -1 An error occurred.
-
- else Bytes actually read. This may be less than the bytes requested,
- indicating an error condition, or an attempt to read past the
- end of file.
-
-
- binio_write(handle, buffer, bytes)
- -----------------------------------------------------------------------
- PURPOSE:
- Write data to a file, at the current file pointer position.
-
- PARAMETERS:
-
- handle
- handle to opened file (from binio_open)
-
- buffer
- memory buffer containing data to write
-
- bytes
- bytes to write (0-65534)
-
-
- RETURN VALUE (32 bit integer):
-
- -1 An error occurred.
-
- else Bytes actually written. This may be less than the bytes
- requested, indicating an error condition.
-
-
- binio_seek(handle, offset, where)
- -----------------------------------------------------------------------
- PURPOSE:
- Position the file pointer.
-
- PARAMETERS:
-
- handle
- handle to opened file (from binio_open)
-
- offset
- where to position to
-
- where
- may be one of:
- BINIO_SEEK_SET - using offset, seek to physical position
- BINIO_SEEK_CUR - using offset, seek from current position
- BINIO_SEEK_END - using offset, seek from end of file
-
- RETURN VALUE (32 bit integer):
-
- -1 An error occurred.
-
- else The current file pointer position.
-
- NOTES:
- The file pointer is 0 based.
- Seeking with negative values is allowed.
- binio_seek(handle, 0, BINIO_SEEK_END) seeks to the end of file.
-
-
- binio_tell(handle)
- -----------------------------------------------------------------------
- PURPOSE:
- Retrieve the current file pointer position.
-
- PARAMETERS:
-
- handle
- handle to opened file (from binio_open)
-
- RETURN VALUE (32 bit integer):
-
- -1 An error occurred.
-
- else The current file pointer position.
-
- NOTES:
- The file pointer is 0 based.
-
-
- binio_length(handle)
- -----------------------------------------------------------------------
- PURPOSE:
- Retrieve the length (in bytes) of an opened file.
-
- PARAMETERS:
-
- handle
- handle to opened file (from binio_open)
-
- RETURN VALUE (32 bit integer):
-
- -1 An error occurred.
-
- else The current file length.
-
-