png_set_write_fn() sets the write_data_fn as the output function for writing PNG files instead of using standard C I/O stream functions. png_ptr - pointer to output data structure png_struct io_ptr - pointer to user-defined structure containing information about the output functions. This value may be NULL. write_data_fn - pointer to new output function that shall take the following arguments: - a pointer to a png_struct - a pointer to a structure where output data can be stored - 32-bit unsigned int to indicate number of bytes to write The output function should invoke png_error() to handle any fatal errors and png_warning() to handle non-fatal errors. flush_data_fn - pointer to a new flush function that shall take a pointer to a png_struct as argument. This function shall flush any remaining data in buffers used by the output function. If the output function does not buffer output, a function prototype must still be supplied.