diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2003-09-09 19:57:43 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2003-09-09 19:57:43 (GMT) |
commit | 79ad8414d813c1126e2807f4321ca4c70d6291fa (patch) | |
tree | c0925e732c4e9f06ccfc3974882096c5f56db513 /src/pngenc.cpp | |
parent | 12ea1b8460a1484b87ba2a4182a94cace98aedf8 (diff) | |
download | Doxygen-79ad8414d813c1126e2807f4321ca4c70d6291fa.zip Doxygen-79ad8414d813c1126e2807f4321ca4c70d6291fa.tar.gz Doxygen-79ad8414d813c1126e2807f4321ca4c70d6291fa.tar.bz2 |
Release-1.3.3-20030909
Diffstat (limited to 'src/pngenc.cpp')
-rw-r--r-- | src/pngenc.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/pngenc.cpp b/src/pngenc.cpp index 3ed69b3..5a52e2f 100644 --- a/src/pngenc.cpp +++ b/src/pngenc.cpp @@ -27,6 +27,8 @@ #include <png.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> +#include <errno.h> #include "pngenc.h" #include "message.h" @@ -133,8 +135,15 @@ void PngEncoder::write(const char *name) png_set_rows(png_ptr,info_ptr,rows); file = fopen(name,"wb"); - png_init_io(png_ptr,file); - png_write_png(png_ptr,info_ptr,PNG_TRANSFORM_IDENTITY,NULL); + if (file==0) + { + err("Error opening png file %s for writing: %s!\n",name,strerror(errno)); + } + else + { + png_init_io(png_ptr,file); + png_write_png(png_ptr,info_ptr,PNG_TRANSFORM_IDENTITY,NULL); + } } png_destroy_write_struct(&png_ptr, &info_ptr); |