What is the best practice to check that my binary data at the file is not corrupted?
There is some string (lenght + chars) and some MAPs(first size of map, than string).
And when data is corrupted, I get in to an infinite loop, because size of map can be very big value.
Any ideas how to be check and be sure that binary data is not corrupted before/while reading?
The simplest solution is some sort of hash/checksum. There are several options:
Take your pick 🙂