diff options
Diffstat (limited to 'content/notes')
| -rw-r--r-- | content/notes/2024-06-22-write-and-read-structs-to-files-in-c.md | 12 |
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 | ||
| 52 | And reading and serializing back to a struct. | 52 | If we check the contents of the `character.dat` file it should look like this. |
| 53 | |||
| 54 | ```txt | ||
| 55 | $ xxd character.dat | ||
| 56 | 00000000: 4a6f 686e 2044 6f65 0000 0000 0000 0000 John Doe........ | ||
| 57 | 00000010: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
| 58 | 00000020: 0000 0000 0000 0000 0000 0000 0000 0000 ................ | ||
| 59 | 00000030: 0000 0000 1e00 0000 cdcc bc40 ...........@ | ||
| 60 | ``` | ||
| 61 | |||
| 62 | Reading and serializing back to a struct. | ||
| 53 | 63 | ||
| 54 | ```c | 64 | ```c |
| 55 | // read.c | 65 | // read.c |
