aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitja Felicijan <mitja.felicijan@gmail.com>2024-06-22 19:59:47 +0200
committerMitja Felicijan <mitja.felicijan@gmail.com>2024-06-22 19:59:47 +0200
commit29cc82fdeb3a368e8b07a70b09b19effa5dde490 (patch)
tree79c17f7f3e0f5c05be94702ac4eecc14a7557199
parent2088ea284e15ec42a475ea8a0841e2579cd9c937 (diff)
downloadmitjafelicijan.com-29cc82fdeb3a368e8b07a70b09b19effa5dde490.tar.gz
New note: Read, write structs
-rw-r--r--content/notes/2024-06-22-write-and-read-structs-to-files-in-c.md12
1 files changed, 11 insertions, 1 deletions
diff --git a/content/notes/2024-06-22-write-and-read-structs-to-files-in-c.md b/content/notes/2024-06-22-write-and-read-structs-to-files-in-c.md
index d5508e8..192bdfe 100644
--- a/content/notes/2024-06-22-write-and-read-structs-to-files-in-c.md
+++ b/content/notes/2024-06-22-write-and-read-structs-to-files-in-c.md
@@ -49,7 +49,17 @@ int main(void) {
49} 49}
50``` 50```
51 51
52And reading and serializing back to a struct. 52If we check the contents of the `character.dat` file it should look like this.
53
54```txt
55$ xxd character.dat
5600000000: 4a6f 686e 2044 6f65 0000 0000 0000 0000 John Doe........
5700000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................
5800000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................
5900000030: 0000 0000 1e00 0000 cdcc bc40 ...........@
60```
61
62Reading and serializing back to a struct.
53 63
54```c 64```c
55// read.c 65// read.c