OSDN Git Service

[FILEIO] Add FILEIO::Fflush().
authorK.Ohta <whatisthis.sowhat@gmail.com>
Fri, 29 Jun 2018 10:05:42 +0000 (19:05 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Fri, 29 Jun 2018 10:05:42 +0000 (19:05 +0900)
source/src/fileio.cpp
source/src/fileio.h

index 15b493f..1cc4e77 100644 (file)
@@ -793,6 +793,18 @@ size_t FILEIO::Fread(void* buffer, size_t size, size_t count)
        return 0;
 }
 
+bool FILEIO::Fflush()
+{
+#ifdef USE_ZLIB
+       if(gz != NULL) {
+               return (gzflush(gz, Z_SYNC_FLUSH) == Z_OK) ? true : false;
+       } else
+#endif
+       {
+               return (fflush(fp) == 0) ? true : false;
+       }
+}
+
 size_t FILEIO::Fwrite(const void* buffer, size_t size, size_t count)
 {
 #ifdef USE_ZLIB
index d94f49b..1f0a83c 100644 (file)
@@ -126,9 +126,10 @@ public:
        _TCHAR *Fgetts(_TCHAR *str, int n);
        int Fprintf(const char* format, ...);
        int Ftprintf(const _TCHAR* format, ...);
-       
+
        size_t Fread(void* buffer, size_t size, size_t count);
        size_t Fwrite(const void* buffer, size_t size, size_t count);
+       bool Fflush();
        int Fseek(long offset, int origin);
        long Ftell();
        bool Fcompare(const void* buffer, size_t size);