X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;f=src%2Freadwrite.h;h=cf4de14cb108750527cc0368e88ee2f68546cd43;hb=fd4745e5d345fcce8bd9f41c2f5a10482de448be;hp=84085d27d5e0ac50062d6fc2e4ac3f173bb61235;hpb=35cdeffc062d3d87f1526bbff10c401b56b1345a;p=plomrogue
diff --git a/src/readwrite.h b/src/readwrite.h
index 84085d2..cf4de14 100644
--- a/src/readwrite.h
+++ b/src/readwrite.h
@@ -1,18 +1,28 @@
-/* readwrite.h:
+/* readwrite.h:
*
- * Routines for reading/writing multibyte data from/to files. They ensure a
- * defined endianness.
+ * Routines for reading/writing (multi-)byte data from/to files. They ensure a
+ * defined endianness.
*/
#ifndef READWRITE_H
#define READWRITE_H
-#include
-#include
-extern uint16_t read_uint16_bigendian(FILE * file);
-extern uint32_t read_uint32_bigendian(FILE * file);
-extern void write_uint16_bigendian(uint16_t x, FILE * file);
-extern void write_uint32_bigendian(uint32_t x, FILE * file);
+
+#include /* for FILE typedef */
+#include /* for uint8_t, uint16_t, uint32_t */
+
+
+
+/* Each function returns 0 on success and 1 on failure. "x" is the value to be
+ * written to "file" for write_* functions and for read_* functions the pointer
+ * to where the value read from "file" is to be written.
+ */
+extern uint8_t read_uint8(FILE * file, uint8_t * x);
+extern uint8_t read_uint16_bigendian(FILE * file, uint16_t * x);
+extern uint8_t read_uint32_bigendian(FILE * file, uint32_t * x);
+extern uint8_t write_uint8(uint8_t x, FILE * file);
+extern uint8_t write_uint16_bigendian(uint16_t x, FILE * file);
+extern uint8_t write_uint32_bigendian(uint32_t x, FILE * file);
#endif