]> Shamusworld >> Repos - thunder/blobdiff - src/fileio.cpp
Added save states; updated application icon.
[thunder] / src / fileio.cpp
diff --git a/src/fileio.cpp b/src/fileio.cpp
new file mode 100644 (file)
index 0000000..cb0fa72
--- /dev/null
@@ -0,0 +1,28 @@
+//
+// fileio.cpp: File I/O functions
+//
+// by James Hammons
+// (C) 2023 Underground Software
+//
+
+#include "fileio.h"
+
+uint32_t ReadLong(FILE * file)
+{
+       uint32_t r = 0;
+
+       for(int i=0; i<4; i++)
+               r = (r << 8) | fgetc(file);
+
+       return r;
+}
+
+void WriteLong(FILE * file, uint32_t l)
+{
+       for(int i=0; i<4; i++)
+       {
+               fputc((l >> 24) & 0xFF, file);
+               l = l << 8;
+       }
+}
+