png_set_read_fn -- set user-defined function for reading a PNG stream


#include <png.h>

void png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn);


png_set_read_fn() sets the read_data_fn as the input function for reading PNG files instead of using standard C I/O stream functions. png_ptr - pointer to input data structure png_struct io_ptr - pointer to user-defined structure containing information about the input functions. This value may be NULL. read_data_fn - pointer to new input function that shall take the following arguments: - a pointer to a png_struct - a pointer to a structure where input data can be stored - 32-bit unsigned int to indicate number of bytes to read The input function should invoke png_error() to handle any fatal errors and png_warning() to handle non-fatal errors.