/** @file dk3strm.h Header file for streams. The stream API can be used from application code without having to care about the underlaying mechanism, so an application can write to a file or to a gzip- or bzip2-compressed file using the same code. To open a dk3_stream_t we need a (void *) pointer to the object used for I/O operations and a pointer to a callback function dealing with the details. I recommend two callback functions. One versions should close the underlaying object when the stream is closed, the other version shouldn't. For an example you can inspect the code dealing with files in the dk3strm.c file. The dk3stream_file_fct() closes the underlaying FILE *, the dk3stream_file_fct_no_close() function doesn't. If you want to use a dk3_stream_t to write to a file do the following steps: - In your application code open the file using fopen() or dk3sf_fopen_app(). - Open a stream for the file using the dk3stream_open_file_app() function. This function assigns the FILE * pointer and the dk3stream_file_fct_no_close() function to the stream. - When the stream is closed by the dk3stream_close() function the underlaying FILE * is not close automatically. - Close the file. @code FILE *fipo; dk3_stream_t *st; fipo = fopen("myfile.txt", "w"); if(fipo) { st = dk3stream_open_file_app(fipo, st, NULL); if(st) { /* ... use stream ... */ dk3stream_close(st); } fclose(fipo); } @endcode */