Original Post
I'm trying to design a file that has a block of header information followed by a block of binary data, writing it is easy but I'm not sure how to read it correctly. The file would be arranged like so: [header size in bytes] [number of symbols in header] [first symbol] [corresponding data block] [next symbol] [corresponding data block]...[last symbol] [last data block] [end of header] [binary data] Can I read from a file in text mode then switch to binary mode without closing and re-opening the file ? If I can't do that, what would be the proper way to get the size of the header and then start reading binary data after that point ?