>>21869
>"note: this is an extended & reworked example of the book's original, that demonstrates moving data for both the character & binary formats to/from disk files, and confirming the resultant data are identical."
Stop. Congratulations Anon, you've finished with chapter 11; and in fact with a couple of very detailed chapters loaded with information. C++ I/O streams are a bit tricky to master at first, but they are an exceptionally powerful and (nearly-always) elegant approach to I/O management in general. We can't use them
everywhere, but when we can they offer us a unified approach to the world of data I/O that otherwise can be quite chaotic!
Your time invested in mastering C++ streams is time well-spent Anon. Cheers. :^)
---
>p391_v2 command line + possible output:
g++ -std=c++20 -O2 -Wall -pedantic ./ch_11/main_p391_v2.cpp && ./a.out
-rw-r--r-- 1 2001 2000 20 Apr 9 04:53 ints.bin
-rw-r--r-- 1 2001 2000 57 Apr 9 04:53 ints.txt
sizeof(char): 1
sizeof(int): 4
sizeof(double): 8
source data (using C++ types):
2147483647
-2147483648
2147483647
-2147483648
2147483647
reconstructed data (from binary file):
2147483647
-2147483648
2147483647
-2147483648
2147483647
in-memory vector sizes match: true
---
>p391_v2 example code
https://rentry.org/PPP2_p391_v2
https://coliru.stacked-crooked.com/a/26eb71ffe5a890d4