STRead(3) Impressario STRead(3)NAME
STRead, STWrite - read/write STIFF image data
SYNOPSIS
#include <stdio.h>
#include <stiff.h>
int STRead(STStream *st, void *buf, int nbytes);
int STWrite(STStream *st, void *buf, int nbytes);
DESCRIPTIONSTRead reads the specified amount of image data from a STIFF stream. The
stream specified by st must have been opened as ST_READ. The number of
bytes of image data specified by nbytes is read into the caller supplied
buffer buf. STRead is called after a call to STReadImageHeader (or
PSTReadImageHeader), which will have supplied in the image header
structure the amount of image data available for reading.
STWrite writes the specified amount of image data to a STIFF stream. The
stream specified by st must have been opened as ST_WRITE. The number of
bytes of image data specified by nbytes is written from the caller
supplied buffer buf. STWrite is called after a call to STWriteImageHeader
(or PSTWriteImageHeader), which will have initialized a page for the
writing of image data.
RETURN VALUE
Both STRead and STWrite return the number of bytes read or written if
execution was successful. -1 is returned and STerrno is set if an
execution error has occurred.
Note that it is possible for STRead to return a number that is smaller
than nbytes. This happens if STRead encounters an end of file before it
has read nbytes of data. In this situation, the number of bytes read is
returned and STerrno is set to STEEOF.
EXECUTION ERROR CODESSTRead will fail under the following circumstances.
STEREADFROMWRITE Attempt to read from a write stream.
STESYSCALL System call failed.
STEEOF End of stream.
STWrite will fail under the following circumstances.
STEWRITETOREAD Attempt to write to a read only stream.
STESYSCALL System call failed.
Page 1
STRead(3) Impressario STRead(3)SEE ALSOlibstiff(3).
Page 2