I/O stream class.
Macros:
Enumerations:
None.
Typedefs:
None.
Struct CapyStreamIo :
Struct CapyStreamIo's properties:
The pathname to the stream (may be null)
The stream
Struct CapyStreamIo's methods:
Destructor
Open the stream for a given pathname and given mode If the StreamIo was already opened it is closed before opening the new one.
Input argument(s):
pathname: the pathname to the file of the stream
mode: the mode as in fopen()
Exceptions: May raise CapyExc_MallocFailed, CapyExc_StreamOpenError
Close the stream
Load the content of a text file line per line
Output and side effect(s):
Return the content of the file as a newly allocated list of array of char Exceptions: May raise CapyExc_MallocFailed, CapyExc_StreamReadError
Save a list of lines to a text file
Input argument(s):
lines: a list of array of char, the lines to save
Exceptions: May raise CapyExc_StreamWriteError
Load the raw content of a file
Output and side effect(s):
Return the content of the file as an array of char Exceptions: May raise CapyExc_MallocFailed, CapyExc_StreamReadError
Save data to a file
Input argument(s):
data: an array of char, the data to save
Exceptions: May raise CapyExc_StreamWriteError
Check if a stream is opened
Output and side effect(s):
Return true if the stream is opened, else false
Read bytes from a file
Input argument(s):
data: pointer to where the data are written
size: the size in bytes of the read data
Exceptions: May raise CapyExc_StreamReadError
Write bytes to a file
Input argument(s):
data: pointer to the data
size: the size in bytes of the data
Exceptions: May raise CapyExc_StreamWriteError
Get the size of the file associated to the stream.
Output and side effect(s):
Return the size in bytes of the file, or 0 if the stream is not opened or any error occured.
Functions:
Create a CapyStreamIo
Output and side effect(s):
Return a CapyStreamIo
Allocate memory for a new CapyStreamIo and create it
Output and side effect(s):
Return a CapyStreamIo
Exception(s):
May raise CapyExc_MallocFailed.
Free the memory used by a CapyStreamIo* and reset '*that' to NULL
Input argument(s):
that: a pointer to the CapyStreamIo to free