X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ffileio.cpp;fp=src%2Ffileio.cpp;h=cb0fa72899d1d618d9a46cd00bd137a8cbf6db37;hb=9eb5812230547fd62f2413d84a0dcc9e1336be21;hp=0000000000000000000000000000000000000000;hpb=a046907b274eb0cfa9c10a4c68fb38255f96714c;p=thunder diff --git a/src/fileio.cpp b/src/fileio.cpp new file mode 100644 index 0000000..cb0fa72 --- /dev/null +++ b/src/fileio.cpp @@ -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; + } +} +