diff --git a/CImg.h b/CImg.h
index 22a7165ad8c76507c675b893f988648ac3814247..66d06e79263a0aa1989ecc8f68f0a68dc7a79248 100644
--- a/CImg.h
+++ b/CImg.h
@@ -173,9 +173,6 @@
 #include <dirent.h>
 #include <fnmatch.h>
 #elif cimg_OS==2
-#ifndef std_fopen
-#define std_fopen cimg::win_fopen
-#endif
 #ifndef NOMINMAX
 #define NOMINMAX
 #endif
@@ -362,9 +359,6 @@
 #ifndef cimg_abort_test2
 #define cimg_abort_test2
 #endif
-#ifndef std_fopen
-#define std_fopen std::fopen
-#endif
 
 // Include display-specific headers.
 #if cimg_display==1
@@ -6177,8 +6171,28 @@ namespace cimg_library_suffixed {
       }
     }
 
-    // Open a file (with wide character support on Windows).
-    inline std::FILE *win_fopen(const char *const path, const char *const mode);
+    // Open a file (similar to std:: fopen(), but with wide character support on Windows).
+    inline std::FILE *std_fopen(const char *const path, const char *const mode) {
+      std::FILE *const res = std::fopen(path,mode);
+      if (res) return res;
+#if cimg_OS==2
+      // Try alternative method, with wide-character string.
+      int err = MultiByteToWideChar(CP_UTF8,0,path,-1,0,0);
+      if (err) {
+        CImg<wchar_t> wpath(err);
+        err = MultiByteToWideChar(CP_UTF8,0,path,-1,wpath,err);
+        if (err) { // Convert 'mode' to a wide-character string.
+          err = MultiByteToWideChar(CP_UTF8,0,mode,-1,0,0);
+          if (err) {
+            CImg<wchar_t> wmode(err);
+            if (MultiByteToWideChar(CP_UTF8,0,mode,-1,wmode,err))
+              return _wfopen(wpath,wmode);
+          }
+        }
+      }
+#endif
+      return 0;
+    }
 
     //! Open a file.
     /**
@@ -6206,7 +6220,7 @@ namespace cimg_library_suffixed {
 #endif
         }
 #endif
-      } else res = std_fopen(path,mode);
+      } else res = cimg::std_fopen(path,mode);
       if (!res) throw CImgIOException("cimg::fopen(): Failed to open file '%s' with mode '%s'.",
                                       path,mode);
       return res;
@@ -6269,9 +6283,9 @@ namespace cimg_library_suffixed {
     **/
     inline bool is_file(const char *const path) {
       if (!path || !*path) return false;
-      std::FILE *const file = std_fopen(path,"rb");
+      std::FILE *const file = cimg::std_fopen(path,"rb");
       if (!file) return false;
-      std::fclose(file);
+      cimg::fclose(file);
       return !is_directory(path);
     }
 
@@ -6281,11 +6295,11 @@ namespace cimg_library_suffixed {
        \return File size or '-1' if file does not exist.
     **/
     inline cimg_int64 fsize(const char *const filename) {
-      std::FILE *const file = std_fopen(filename,"rb");
+      std::FILE *const file = cimg::std_fopen(filename,"rb");
       if (!file) return (cimg_int64)-1;
       std::fseek(file,0,SEEK_END);
       const cimg_int64 siz = (cimg_int64)std::ftell(file);
-      std::fclose(file);
+      cimg::fclose(file);
       return siz;
     }
 
@@ -47251,7 +47265,7 @@ namespace cimg_library_suffixed {
             std::FILE *file;
             do {
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.bmp",snap_number++);
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             if (visu0) {
               (+visu0).draw_text(0,0," Saving snapshot... ",foreground_color,background_color,0.7f,13).display(disp);
@@ -47270,7 +47284,7 @@ namespace cimg_library_suffixed {
 #else
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.cimg",snap_number++);
 #endif
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu0).draw_text(0,0," Saving instance... ",foreground_color,background_color,0.7f,13).display(disp);
             save(filename);
@@ -48011,7 +48025,7 @@ namespace cimg_library_suffixed {
               std::FILE *file;
               do {
                 cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.bmp",snap_number++);
-                if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+                if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
               } while (file);
               (+screen).draw_text(0,0," Saving snapshot... ",black,gray,1,13).display(disp);
               screen.save(filename);
@@ -48030,7 +48044,7 @@ namespace cimg_library_suffixed {
 #else
                 cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.cimg",snap_number++);
 #endif
-                if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+                if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
               } while (file);
               (+screen).draw_text(0,0," Saving instance... ",black,gray,1,13).display(disp);
               save(filename);
@@ -48206,7 +48220,7 @@ namespace cimg_library_suffixed {
 
       // If nothing loaded, try to guess file format from magic number in file.
       if (!is_loaded) {
-        std::FILE *file = std_fopen(filename,"rb");
+        std::FILE *file = cimg::std_fopen(filename,"rb");
         if (!file) {
           cimg::exception_mode(omode);
           throw CImgIOException(_cimg_instance
@@ -48216,7 +48230,7 @@ namespace cimg_library_suffixed {
         }
 
         const char *const f_type = cimg::ftype(file,filename);
-        std::fclose(file);
+        cimg::fclose(file);
         is_loaded = true;
         try {
           if (!cimg::strcasecmp(f_type,"pnm")) load_pnm(filename);
@@ -50881,7 +50895,7 @@ namespace cimg_library_suffixed {
         throw CImgArgumentException(_cimg_instance
                                     "load_graphicsmagick_external(): Specified filename is (null).",
                                     cimg_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256);
       std::FILE *file = 0;
       const CImg<charT> s_filename = CImg<charT>::string(filename)._system_strescape();
@@ -50910,13 +50924,13 @@ namespace cimg_library_suffixed {
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.pnm",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(command,command._width,"%s convert \"%s\" \"%s\"",
                     cimg::graphicsmagick_path(),s_filename.data(),
                     CImg<charT>::string(filename_tmp)._system_strescape().data());
       cimg::system(command,cimg::graphicsmagick_path());
-      if (!(file = std_fopen(filename_tmp,"rb"))) {
+      if (!(file=cimg::std_fopen(filename_tmp,"rb"))) {
         cimg::fclose(cimg::fopen(filename,"r"));
         throw CImgIOException(_cimg_instance
                               "load_graphicsmagick_external(): Failed to load file '%s' with external command 'gm'.",
@@ -50943,7 +50957,7 @@ namespace cimg_library_suffixed {
         throw CImgIOException(_cimg_instance
                               "load_gzip_external(): Specified filename is (null).",
                               cimg_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256), body(256);
       const char
         *const ext = cimg::split_filename(filename,body),
@@ -50962,14 +50976,14 @@ namespace cimg_library_suffixed {
           else cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s",
                              cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         }
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(command,command._width,"%s -c \"%s\" > \"%s\"",
                     cimg::gunzip_path(),
                     CImg<charT>::string(filename)._system_strescape().data(),
                     CImg<charT>::string(filename_tmp)._system_strescape().data());
       cimg::system(command);
-      if (!(file = std_fopen(filename_tmp,"rb"))) {
+      if (!(file=cimg::std_fopen(filename_tmp,"rb"))) {
         cimg::fclose(cimg::fopen(filename,"r"));
         throw CImgIOException(_cimg_instance
                               "load_gzip_external(): Failed to load file '%s' with external command 'gunzip'.",
@@ -50996,7 +51010,7 @@ namespace cimg_library_suffixed {
         throw CImgArgumentException(_cimg_instance
                                     "load_imagemagick_external(): Specified filename is (null).",
                                     cimg_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256);
       std::FILE *file = 0;
       const CImg<charT> s_filename = CImg<charT>::string(filename)._system_strescape();
@@ -51027,14 +51041,14 @@ namespace cimg_library_suffixed {
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.pnm",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(command,command._width,"%s%s \"%s\" \"%s\"",
                     cimg::imagemagick_path(),
                     !cimg::strcasecmp(cimg::split_filename(filename),"pdf")?" -density 400x400":"",
                     s_filename.data(),CImg<charT>::string(filename_tmp)._system_strescape().data());
       cimg::system(command,cimg::imagemagick_path());
-      if (!(file = std_fopen(filename_tmp,"rb"))) {
+      if (!(file=cimg::std_fopen(filename_tmp,"rb"))) {
         cimg::fclose(cimg::fopen(filename,"r"));
         throw CImgIOException(_cimg_instance
                               "load_imagemagick_external(): Failed to load file '%s' with "
@@ -51062,13 +51076,13 @@ namespace cimg_library_suffixed {
         throw CImgArgumentException(_cimg_instance
                                     "load_medcon_external(): Specified filename is (null).",
                                     cimg_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256), body(256);
       cimg::fclose(cimg::fopen(filename,"r"));
       std::FILE *file = 0;
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s.hdr",cimg::filenamerand());
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(command,command._width,"%s -w -c anlz -o \"%s\" -f \"%s\"",
                     cimg::medcon_path(),
@@ -51078,10 +51092,10 @@ namespace cimg_library_suffixed {
       cimg::split_filename(filename_tmp,body);
 
       cimg_snprintf(command,command._width,"%s.hdr",body._data);
-      file = std_fopen(command,"rb");
+      file = cimg::std_fopen(command,"rb");
       if (!file) {
         cimg_snprintf(command,command._width,"m000-%s.hdr",body._data);
-        file = std_fopen(command,"rb");
+        file = cimg::std_fopen(command,"rb");
         if (!file) {
           throw CImgIOException(_cimg_instance
                                 "load_medcon_external(): Failed to load file '%s' with external command 'medcon'.",
@@ -51112,7 +51126,7 @@ namespace cimg_library_suffixed {
         throw CImgArgumentException(_cimg_instance
                                     "load_dcraw_external(): Specified filename is (null).",
                                     cimg_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256);
       std::FILE *file = 0;
       const CImg<charT> s_filename = CImg<charT>::string(filename)._system_strescape();
@@ -51138,12 +51152,12 @@ namespace cimg_library_suffixed {
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.ppm",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(command,command._width,"%s -w -4 -c \"%s\" > \"%s\"",
                     cimg::dcraw_path(),s_filename.data(),CImg<charT>::string(filename_tmp)._system_strescape().data());
       cimg::system(command,cimg::dcraw_path());
-      if (!(file = std_fopen(filename_tmp,"rb"))) {
+      if (!(file=cimg::std_fopen(filename_tmp,"rb"))) {
         cimg::fclose(cimg::fopen(filename,"r"));
         throw CImgIOException(_cimg_instance
                               "load_dcraw_external(): Failed to load file '%s' with external command 'dcraw'.",
@@ -51265,7 +51279,7 @@ namespace cimg_library_suffixed {
             try { load_cimg(filename); }
             catch (CImgException&) {
               try {
-                std::fclose(cimg::fopen(filename,"rb"));
+                cimg::fclose(cimg::fopen(filename,"rb"));
               } catch (CImgException&) {
                 cimg::exception_mode(omode);
                 throw CImgIOException(_cimg_instance
@@ -52114,7 +52128,7 @@ namespace cimg_library_suffixed {
             std::FILE *file;
             do {
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.bmp",snap_number++);
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu).draw_text(0,0," Saving snapshot... ",
                               foreground_color._data,background_color._data,0.7f,13).display(disp);
@@ -52128,7 +52142,7 @@ namespace cimg_library_suffixed {
             std::FILE *file;
             do {
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.off",snap_number++);
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu).draw_text(0,0," Saving object... ",
                               foreground_color._data,background_color._data,0.7f,13).display(disp);
@@ -52146,7 +52160,7 @@ namespace cimg_library_suffixed {
 #else
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.cimg",snap_number++);
 #endif
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu).draw_text(0,0," Saving object... ",
                               foreground_color._data,background_color._data,0.7f,13).display(disp);
@@ -52162,7 +52176,7 @@ namespace cimg_library_suffixed {
             std::FILE *file;
             do {
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.eps",snap_number++);
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu).draw_text(0,0," Saving EPS snapshot... ",
                               foreground_color._data,background_color._data,0.7f,13).display(disp);
@@ -52185,7 +52199,7 @@ namespace cimg_library_suffixed {
             std::FILE *file;
             do {
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.svg",snap_number++);
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu).draw_text(0,0," Saving SVG snapshot... ",
                               foreground_color._data,background_color._data,0.7f,13).display(disp);
@@ -54457,7 +54471,7 @@ namespace cimg_library_suffixed {
           else cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.cimg",
                              cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         }
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       save(filename_tmp);
       cimg_snprintf(command,command._width,"%s -c \"%s\" > \"%s\"",
@@ -54465,7 +54479,7 @@ namespace cimg_library_suffixed {
                     CImg<charT>::string(filename_tmp)._system_strescape().data(),
                     CImg<charT>::string(filename)._system_strescape().data());
       cimg::system(command);
-      file = std_fopen(filename,"rb");
+      file = cimg::std_fopen(filename,"rb");
       if (!file)
         throw CImgIOException(_cimg_instance
                               "save_gzip_external(): Failed to save file '%s' with external command 'gzip'.",
@@ -54510,7 +54524,7 @@ namespace cimg_library_suffixed {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.%s",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand(),
                       _spectrum==1?_cimg_sge_ext1:_cimg_sge_ext2);
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
 #ifdef cimg_use_png
       save_png(filename_tmp);
@@ -54522,7 +54536,7 @@ namespace cimg_library_suffixed {
                     CImg<charT>::string(filename_tmp)._system_strescape().data(),
                     CImg<charT>::string(filename)._system_strescape().data());
       cimg::system(command);
-      file = std_fopen(filename,"rb");
+      file = cimg::std_fopen(filename,"rb");
       if (!file)
         throw CImgIOException(_cimg_instance
                               "save_graphicsmagick_external(): Failed to save file '%s' with external command 'gm'.",
@@ -54565,7 +54579,7 @@ namespace cimg_library_suffixed {
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.%s",cimg::temporary_path(),
                       cimg_file_separator,cimg::filenamerand(),_spectrum==1?_cimg_sie_ext1:_cimg_sie_ext2);
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
 #ifdef cimg_use_png
       save_png(filename_tmp);
@@ -54577,7 +54591,7 @@ namespace cimg_library_suffixed {
                     CImg<charT>::string(filename_tmp)._system_strescape().data(),
                     CImg<charT>::string(filename)._system_strescape().data());
       cimg::system(command);
-      file = std_fopen(filename,"rb");
+      file = cimg::std_fopen(filename,"rb");
       if (!file)
         throw CImgIOException(_cimg_instance
                               "save_imagemagick_external(): Failed to save file '%s' with "
@@ -54608,7 +54622,7 @@ namespace cimg_library_suffixed {
       std::FILE *file;
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s.hdr",cimg::filenamerand());
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       save_analyze(filename_tmp);
       cimg_snprintf(command,command._width,"%s -w -c dicom -o \"%s\" -f \"%s\"",
@@ -54621,10 +54635,10 @@ namespace cimg_library_suffixed {
       cimg_snprintf(filename_tmp,filename_tmp._width,"%s.img",body._data);
       std::remove(filename_tmp);
 
-      file = std_fopen(filename,"rb");
+      file = cimg::std_fopen(filename,"rb");
       if (!file) {
         cimg_snprintf(command,command._width,"m000-%s",filename);
-        file = std_fopen(command,"rb");
+        file = cimg::std_fopen(command,"rb");
         if (!file) {
           cimg::fclose(cimg::fopen(filename,"r"));
           throw CImgIOException(_cimg_instance
@@ -57240,7 +57254,7 @@ namespace cimg_library_suffixed {
             std::FILE *file;
             do {
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.bmp",snap_number++);
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             if (visu0) {
               (+visu0).draw_text(0,0," Saving snapshot... ",
@@ -57261,7 +57275,7 @@ namespace cimg_library_suffixed {
 #else
               cimg_snprintf(filename,filename._width,cimg_appname "_%.4u.cimg",snap_number++);
 #endif
-              if ((file=std_fopen(filename,"r"))!=0) cimg::fclose(file);
+              if ((file=cimg::std_fopen(filename,"r"))!=0) cimg::fclose(file);
             } while (file);
             (+visu0).draw_text(0,0," Saving instance... ",
                                foreground_color,background_color,0.7f,13).display(disp);
@@ -57378,7 +57392,7 @@ namespace cimg_library_suffixed {
 
       // If nothing loaded, try to guess file format from magic number in file.
       if (!is_loaded && !is_stdin) {
-        std::FILE *const file = std_fopen(filename,"rb");
+        std::FILE *const file = cimg::std_fopen(filename,"rb");
         if (!file) {
           cimg::exception_mode(omode);
           throw CImgIOException(_cimglist_instance
@@ -57388,7 +57402,7 @@ namespace cimg_library_suffixed {
         }
 
         const char *const f_type = cimg::ftype(file,filename);
-        std::fclose(file);
+        cimg::fclose(file);
         is_loaded = true;
         try {
           if (!cimg::strcasecmp(f_type,"gif")) load_gif_external(filename);
@@ -58099,7 +58113,7 @@ namespace cimg_library_suffixed {
         cimg::mutex(9,0);
         if (!captures[index]) {
           filenames[index].assign();
-          std::fclose(cimg::fopen(filename,"rb"));  // Check file availability.
+          cimg::fclose(cimg::fopen(filename,"rb"));  // Check file availability.
           throw CImgIOException(_cimglist_instance
                                 "load_video(): File '%s', unable to detect format of video file.",
                                 cimglist_instance,filename);
@@ -58191,14 +58205,14 @@ namespace cimg_library_suffixed {
         throw CImgArgumentException(_cimglist_instance
                                     "load_ffmpeg_external(): Specified filename is (null).",
                                     cimglist_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256), filename_tmp2(256);
       std::FILE *file = 0;
       do {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s_000001.ppm",filename_tmp._data);
-        if ((file=std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s_%%6d.ppm",filename_tmp._data);
       cimg_snprintf(command,command._width,"%s -i \"%s\" \"%s\"",
@@ -58240,7 +58254,7 @@ namespace cimg_library_suffixed {
         throw CImgArgumentException(_cimglist_instance
                                     "load_gif_external(): Specified filename is (null).",
                                     cimglist_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       if (!_load_gif_external(filename,false))
         if (!_load_gif_external(filename,true))
           try { assign(CImg<T>().load_other(filename)); } catch (CImgException&) { assign(); }
@@ -58259,7 +58273,7 @@ namespace cimg_library_suffixed {
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         if (use_graphicsmagick) cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s.png.0",filename_tmp._data);
         else cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s-0.png",filename_tmp._data);
-        if ((file=std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
       } while (file);
       if (use_graphicsmagick) cimg_snprintf(command,command._width,"%s convert \"%s\" \"%s.png\"",
                                             cimg::graphicsmagick_path(),
@@ -58309,7 +58323,7 @@ namespace cimg_library_suffixed {
         throw CImgIOException(_cimglist_instance
                               "load_gzip_external(): Specified filename is (null).",
                               cimglist_instance);
-      std::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
+      cimg::fclose(cimg::fopen(filename,"rb"));            // Check if file exists.
       CImg<charT> command(1024), filename_tmp(256), body(256);
       const char
         *ext = cimg::split_filename(filename,body),
@@ -58327,14 +58341,14 @@ namespace cimg_library_suffixed {
           else cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s",
                              cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         }
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimg_snprintf(command,command._width,"%s -c \"%s\" > \"%s\"",
                     cimg::gunzip_path(),
                     CImg<charT>::string(filename)._system_strescape().data(),
                     CImg<charT>::string(filename_tmp)._system_strescape().data());
       cimg::system(command);
-      if (!(file = std_fopen(filename_tmp,"rb"))) {
+      if (!(file=cimg::std_fopen(filename_tmp,"rb"))) {
         cimg::fclose(cimg::fopen(filename,"r"));
         throw CImgIOException(_cimglist_instance
                               "load_gzip_external(): Failed to open file '%s'.",
@@ -58782,7 +58796,7 @@ namespace cimg_library_suffixed {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s_000001." _cimg_save_gif_ext,filename_tmp._data);
-        if ((file=std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimglist_for(*this,l) {
         cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s_%.6u." _cimg_save_gif_ext,filename_tmp._data,l + 1);
@@ -58801,7 +58815,7 @@ namespace cimg_library_suffixed {
       _command.back() = 0;
 
       cimg::system(_command);
-      file = std_fopen(filename,"rb");
+      file = cimg::std_fopen(filename,"rb");
       if (!file)
         throw CImgIOException(_cimglist_instance
                               "save_gif_external(): Failed to save file '%s' with external command 'magick/convert'.",
@@ -59216,7 +59230,7 @@ namespace cimg_library_suffixed {
           else cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s.cimg",
                              cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         }
-        if ((file=std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp,"rb"))!=0) cimg::fclose(file);
       } while (file);
 
       if (is_saveable(body)) {
@@ -59226,7 +59240,7 @@ namespace cimg_library_suffixed {
                       CImg<charT>::string(filename_tmp)._system_strescape().data(),
                       CImg<charT>::string(filename)._system_strescape().data());
         cimg::system(command);
-        file = std_fopen(filename,"rb");
+        file = cimg::std_fopen(filename,"rb");
         if (!file)
           throw CImgIOException(_cimglist_instance
                                 "save_gzip_external(): Failed to save file '%s' with external command 'gzip'.",
@@ -59402,7 +59416,7 @@ namespace cimg_library_suffixed {
         cimg_snprintf(filename_tmp,filename_tmp._width,"%s%c%s",
                       cimg::temporary_path(),cimg_file_separator,cimg::filenamerand());
         cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s_000001.ppm",filename_tmp._data);
-        if ((file=std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
+        if ((file=cimg::std_fopen(filename_tmp2,"rb"))!=0) cimg::fclose(file);
       } while (file);
       cimglist_for(*this,l) {
         cimg_snprintf(filename_tmp2,filename_tmp2._width,"%s_%.6u.ppm",filename_tmp._data,l + 1);
@@ -59416,7 +59430,7 @@ namespace cimg_library_suffixed {
                     _codec,bitrate,fps,
                     CImg<charT>::string(filename)._system_strescape().data());
       cimg::system(command);
-      file = std_fopen(filename,"rb");
+      file = cimg::std_fopen(filename,"rb");
       if (!file)
         throw CImgIOException(_cimglist_instance
                               "save_ffmpeg_external(): Failed to save file '%s' with external command 'ffmpeg'.",
@@ -59813,32 +59827,6 @@ namespace cimg {
 #endif
   }
 
-  // Open a file (with wide character support on Windows).
-  inline std::FILE *win_fopen(const char *const path, const char *const mode) {
-#if cimg_OS==2
-    std::FILE *const res = std::fopen(path,mode);
-    if (res) return res;
-
-    // Try alternative method, with wide-character string.
-    int err = MultiByteToWideChar(CP_UTF8,0,path,-1,0,0);
-    if (err) {
-      CImg<wchar_t> wpath(err);
-      err = MultiByteToWideChar(CP_UTF8,0,path,-1,wpath,err);
-      if (err) { // Convert 'mode' to a wide-character string.
-        err = MultiByteToWideChar(CP_UTF8,0,mode,-1,0,0);
-        if (err) {
-          CImg<wchar_t> wmode(err);
-          if (MultiByteToWideChar(CP_UTF8,0,mode,-1,wmode,err))
-            return _wfopen(wpath,wmode);
-        }
-      }
-    }
-    return 0;
-#else
-    return std::fopen(path,mode);
-#endif
-  }
-
   //! Get/set path to store temporary files.
   /**
      \param user_path Specified path, or \c 0 to get the path currently used.
@@ -59850,7 +59838,7 @@ namespace cimg {
     if (!path_found) {                                                  \
       cimg_snprintf(s_path,s_path.width(),"%s",p);                      \
       cimg_snprintf(tmp,tmp._width,"%s%c%s",s_path.data(),cimg_file_separator,filename_tmp._data); \
-      if ((file=std_fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; } \
+      if ((file=cimg::std_fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; } \
     }
     static CImg<char> s_path;
     cimg::mutex(7);
@@ -59883,7 +59871,7 @@ namespace cimg {
       if (!path_found) {
         *s_path = 0;
         std::strncpy(tmp,filename_tmp,tmp._width - 1);
-        if ((file=std_fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; }
+        if ((file=cimg::std_fopen(tmp,"wb"))!=0) { cimg::fclose(file); std::remove(tmp); path_found = true; }
       }
       if (!path_found) {
         cimg::mutex(7,0);
@@ -59949,87 +59937,87 @@ namespace cimg {
       for (int l = 0; l<2 && !path_found; ++l) {
         const char *const s_exe = l?"convert":"magick";
         cimg_snprintf(s_path,s_path._width,".\\%s.exe",s_exe);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         for (int k = 32; k>=10 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"%s\\IMAGEM~1.%.2d-\\%s.exe",pf_path,k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 9; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"%s\\IMAGEM~1.%d-Q\\%s.exe",pf_path,k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"%s\\IMAGEM~1.%d\\%s.exe",pf_path,k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=10 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"%s\\IMAGEM~1.%.2d-\\VISUA~1\\BIN\\%s.exe",pf_path,k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 9; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"%s\\IMAGEM~1.%d-Q\\VISUA~1\\BIN\\%s.exe",pf_path,k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"%s\\IMAGEM~1.%d\\VISUA~1\\BIN\\%s.exe",pf_path,k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=10 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"C:\\IMAGEM~1.%.2d-\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 9; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"C:\\IMAGEM~1.%d-Q\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"C:\\IMAGEM~1.%d\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=10 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"C:\\IMAGEM~1.%.2d-\\VISUA~1\\BIN\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 9; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"C:\\IMAGEM~1.%d-Q\\VISUA~1\\BIN\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"C:\\IMAGEM~1.%d\\VISUA~1\\BIN\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=10 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"D:\\IMAGEM~1.%.2d-\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 9; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"D:\\IMAGEM~1.%d-Q\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"D:\\IMAGEM~1.%d\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=10 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"D:\\IMAGEM~1.%.2d-\\VISUA~1\\BIN\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 9; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"D:\\IMAGEM~1.%d-Q\\VISUA~1\\BIN\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         for (int k = 32; k>=0 && !path_found; --k) {
           cimg_snprintf(s_path,s_path._width,"D:\\IMAGEM~1.%d\\VISUA~1\\BIN\\%s.exe",k,s_exe);
-          if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+          if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
         }
         if (!path_found) cimg_snprintf(s_path,s_path._width,"%s.exe",s_exe);
       }
 #else
       std::strcpy(s_path,"./magick");
-      if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+      if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       if (!path_found) {
         std::strcpy(s_path,"./convert");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"convert");
 #endif
@@ -60060,85 +60048,85 @@ namespace cimg {
       const char *const pf_path = programfiles_path();
       if (!path_found) {
         std::strcpy(s_path,".\\gm.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=10 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"%s\\GRAPHI~1.%.2d-\\gm.exe",pf_path,k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 9; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"%s\\GRAPHI~1.%d-Q\\gm.exe",pf_path,k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"%s\\GRAPHI~1.%d\\gm.exe",pf_path,k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=10 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"%s\\GRAPHI~1.%.2d-\\VISUA~1\\BIN\\gm.exe",pf_path,k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 9; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"%s\\GRAPHI~1.%d-Q\\VISUA~1\\BIN\\gm.exe",pf_path,k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"%s\\GRAPHI~1.%d\\VISUA~1\\BIN\\gm.exe",pf_path,k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=10 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"C:\\GRAPHI~1.%.2d-\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 9; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"C:\\GRAPHI~1.%d-Q\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"C:\\GRAPHI~1.%d\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=10 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"C:\\GRAPHI~1.%.2d-\\VISUA~1\\BIN\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 9; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"C:\\GRAPHI~1.%d-Q\\VISUA~1\\BIN\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"C:\\GRAPHI~1.%d\\VISUA~1\\BIN\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=10 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"D:\\GRAPHI~1.%.2d-\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 9; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"D:\\GRAPHI~1.%d-Q\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"D:\\GRAPHI~1.%d\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=10 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"D:\\GRAPHI~1.%.2d-\\VISUA~1\\BIN\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 9; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"D:\\GRAPHI~1.%d-Q\\VISUA~1\\BIN\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       for (int k = 32; k>=0 && !path_found; --k) {
         cimg_snprintf(s_path,s_path._width,"D:\\GRAPHI~1.%d\\VISUA~1\\BIN\\gm.exe",k);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"gm.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./gm");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"gm");
 #endif
@@ -60169,25 +60157,25 @@ namespace cimg {
       const char *const pf_path = programfiles_path();
       if (!path_found) {
         std::strcpy(s_path,".\\medcon.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) {
         cimg_snprintf(s_path,s_path._width,"%s\\XMedCon\\bin\\medcon.bat",pf_path);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) {
         cimg_snprintf(s_path,s_path._width,"%s\\XMedCon\\bin\\medcon.exe",pf_path);
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) {
         std::strcpy(s_path,"C:\\XMedCon\\bin\\medcon.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"medcon.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./medcon");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"medcon");
 #endif
@@ -60217,13 +60205,13 @@ namespace cimg {
 #if cimg_OS==2
       if (!path_found) {
         std::strcpy(s_path,".\\ffmpeg.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"ffmpeg.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./ffmpeg");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"ffmpeg");
 #endif
@@ -60253,13 +60241,13 @@ namespace cimg {
 #if cimg_OS==2
       if (!path_found) {
         std::strcpy(s_path,".\\gzip.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"gzip.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./gzip");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"gzip");
 #endif
@@ -60289,13 +60277,13 @@ namespace cimg {
 #if cimg_OS==2
       if (!path_found) {
         std::strcpy(s_path,".\\gunzip.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"gunzip.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./gunzip");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"gunzip");
 #endif
@@ -60325,13 +60313,13 @@ namespace cimg {
 #if cimg_OS==2
       if (!path_found) {
         std::strcpy(s_path,".\\dcraw.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"dcraw.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./dcraw");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"dcraw");
 #endif
@@ -60361,13 +60349,13 @@ namespace cimg {
 #if cimg_OS==2
       if (!path_found) {
         std::strcpy(s_path,".\\wget.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"wget.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./wget");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"wget");
 #endif
@@ -60397,13 +60385,13 @@ namespace cimg {
 #if cimg_OS==2
       if (!path_found) {
         std::strcpy(s_path,".\\curl.exe");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"curl.exe");
 #else
       if (!path_found) {
         std::strcpy(s_path,"./curl");
-        if ((file=std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
+        if ((file=cimg::std_fopen(s_path,"r"))!=0) { cimg::fclose(file); path_found = true; }
       }
       if (!path_found) std::strcpy(s_path,"curl");
 #endif
@@ -60619,7 +60607,7 @@ namespace cimg {
     do {
       cimg_snprintf(filename_local,256,"%s%c%s%s",
                     cimg::temporary_path(),cimg_file_separator,cimg::filenamerand(),ext._data);
-      if ((file=std_fopen(filename_local,"rb"))!=0) cimg::fclose(file);
+      if ((file=cimg::std_fopen(filename_local,"rb"))!=0) cimg::fclose(file);
     } while (file);
 
 #ifdef cimg_use_curl
@@ -60680,7 +60668,7 @@ namespace cimg {
     }
     cimg::system(command);
 
-    if (!(file = std_fopen(filename_local,"rb"))) {
+    if (!(file=cimg::std_fopen(filename_local,"rb"))) {
 
       // Try with 'wget' otherwise.
       if (timeout) {
@@ -60704,7 +60692,7 @@ namespace cimg {
       }
       cimg::system(command);
 
-      if (!(file = std_fopen(filename_local,"rb")))
+      if (!(file=cimg::std_fopen(filename_local,"rb")))
         throw CImgIOException("cimg::load_network(): Failed to load file '%s' with external commands "
                               "'wget' or 'curl'.",url);
       cimg::fclose(file);
@@ -60715,11 +60703,11 @@ namespace cimg {
       cimg_snprintf(command,command._width,"%s --quiet \"%s.gz\"",
                     gunzip_path(),filename_local);
       cimg::system(command);
-      file = std_fopen(filename_local,"rb");
+      file = cimg::std_fopen(filename_local,"rb");
       if (!file) {
         cimg_snprintf(command,command._width,"%s.gz",filename_local);
         std::rename(command,filename_local);
-        file = std_fopen(filename_local,"rb");
+        file = cimg::std_fopen(filename_local,"rb");
       }
     }
     cimg::fseek(file,0,SEEK_END); // Check if file size is 0.