|
libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
|
Callbacks that provide or accept the bytes of a file. More...
#include <types.h>
Data Fields | |
| void * | user |
| Opaque pointer passed as the first argument of every callback. | |
| size_t(* | read )(void *user, void *data, size_t size) |
| Reads up to size bytes into data. | |
| size_t(* | write )(void *user, const void *data, size_t size) |
| Writes size bytes from data. | |
Callbacks that provide or accept the bytes of a file.
A reader uses read. A writer uses write. The bytes are processed once and in order, as for a pipe. Without an initializer, call sdfio_stream_init() before assigning fields.
The structure is frozen for the major version: it has these three fields and a new property of a stream is a new function.
| size_t(* sdfio_stream::read) (void *user, void *data, size_t size) |
Reads up to size bytes into data.
Returns the number of bytes read, or SDFIO_STREAM_ERROR on failure. The count can be smaller than size at any call, as for a pipe or a socket, and the reader calls again for the rest. Only 0 means the end of the data.
| size_t(* sdfio_stream::write) (void *user, const void *data, size_t size) |
Writes size bytes from data.
Returns the number of bytes written; a count smaller than size indicates a failure.