Main Page Alphabetical List Data Structures File List Data Fields Globals

# stream.c File Reference

## Functions

wmfStream * | wmf_ztream_create (wmfAPI *API, gzFile out)
wmfStream * | wmf_stream_create (wmfAPI *API, FILE *out)
void | wmf_ztream_destroy (wmfAPI *API, wmfStream *stream, char **buffer, unsigned long *length)
void | wmf_stream_destroy (wmfAPI *API, wmfStream *stream, char **buffer, unsigned long *length)
int | wmf_stream_printf (wmfAPI *API, wmfStream *stream, char *format,...)
int | wmf_stream_zputs (char *str, void *context)
int | wmf_stream_sputs (char *str, void *context)
int | wmf_stream_rezet (void *context)
int | wmf_stream_reset (void *context)

## Function Documentation

wmfStream* wmf_stream_create | ( | wmfAPI * | API,
|  | FILE * | out
| ) |

Open an uncompressed character output stream.

Parameters:

  API | the API handle
  out | descriptor for a file stream; or zero to write to memory

wmf_stream_create() creates a wmfStream (a character-based output stream) for output to a file or, if `out` is zero, to memory.

Returns:
  Returns a wmfStream pointer, or zero on failure. Possible library error states of wmf_E_InsMem or wmf_E_BadFile.

void wmf_stream_destroy | ( | wmfAPI * | API,
|  | wmfStream * | stream,
|  | char ** | buffer,
|  | unsigned long * | length
| ) |

Close an uncompressed character output stream.

Parameters:

  API | the API handle
  stream | stream handle
  buffer | for memory return
  length | for length return

In the case of write-to-memory, on return `*buffer` is an array of length `length`.

int wmf_stream_printf | ( | wmfAPI * | API,
|  | wmfStream * | stream,
|  | char * | format,
|  | ... |
| ) |

Formatted print to character output stream.

Parameters:

  API | the API handle
  stream | stream handle
  format | print format

With syntax similar to printf(), wmf_stream_printf() prints a formatted message to a wmfStream character stream.

Returns:
  Returns the number of characters written, or zero on failure. Possible library error state of wmf_E_InsMem.

int wmf_stream_reset | ( | void * |  | ) |

| uncompressed char output (wmf_stream_create): rewind()

int wmf_stream_rezet | ( | void * |  | ) |

| compressed char output (wmf_ztream_create): rewind()

int wmf_stream_sputs | ( | char * | ,
|  | void * |
| ) |

| uncompressed char output (wmf_stream_create): fputs()

int wmf_stream_zputs | ( | char * | ,
|  | void * |
| ) |

| compressed char output (wmf_ztream_create): fputs()

wmfStream* wmf_ztream_create | ( | wmfAPI * | API,
|  | gzFile | out
| ) |

Open a compressed character output stream.

Parameters:

  API | the API handle
  out | descriptor for a zlib compressed file stream

wmf_ztream_create() creates a wmfStream (a character-based output stream) for output to a file opened via zlib. (Writing compressed data to memory is not currently supported.)

Returns:
  Returns a wmfStream pointer, or zero on failure. Possible library error state of wmf_E_InsMem.

void wmf_ztream_destroy | ( | wmfAPI * | API,
|  | wmfStream * | stream,
|  | char ** | buffer,
|  | unsigned long * | length
| ) |

Close a compressed character output stream.

Parameters:

  API | the API handle
  stream | stream handle
  buffer | (unused)
  length | (unused)