libsdfio 1.0.0
Reader and writer for ISO 25178-71 SDF surface data files in C
Loading...
Searching...
No Matches
sdfio_stream Struct Reference

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.

Detailed Description

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.

Examples
read_stream.c, and write_memory.c.

Field Documentation

◆ read

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.

◆ write

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.


The documentation for this struct was generated from the following file:
  • /home/runner/work/libsdfio/libsdfio/include/sdfio/types.h