png_create_read_struct

Name

png_create_read_struct -- allocate and initialize a png_struct structure for reading PNG file

Synopsis

#include <png.h>

png_structp png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn);

Description

png_create_read_struct() shall allocate and initialize a png_struct structure. The function shall return NULL if the allocation fails. The application should check for the return value. For handling errors and warnings, the application can pass desired error handling routines as arguments to png_create_read_struct(). Otherwise, the default error handling uses stderr and longjmp. The error handling routine must NOT return to the calling routine.

user_png_ver 

version string of the library. Must be PNG_LIBPNG_VER_STRING

error_ptr 

user defined struct for error functions.

error_fn 

user defined function for printing errors and aborting.

warn_fn 

user defined function for warnings.

Return Value

Returns the pointer to png_struct structure. Returns NULL if it fails to create the structure.

Errors

png_create_read_struct() shall return NULL if the allocation fails. The application should check for the return value.