E
You seem not to have noticed that I simply described binary formats in general, I didn't go further to describe more specific kinds of binary formats because that seemed beyond the point, and the appropriate format vary a lot depending on use. Anything can be messed up, and independently built file formats do have some proneness to ending up messed up, but that shouldn't keep able programmers from making them. As for your use of the word "clusterfuck", that is what you end up with if you are not an able programmer, but then you project should be a learners project, and making some clusterfuck will probably turn out to be a valuable lesson. Saying that I'm advocating clusterfuck (to anyone not working on toy projects), that is just plain rude.While I think it should be quite possible to generate the file in memory and avoid using a clumsy write routine, my main concern was the actual data, you make some nice variable length integer routines, but don't make them available for the big bulk of data where they would actually make a noticeable impact on file size. In any case, that's technicalities, if you are only handling thousands of nodes this is certainly not going to make or break the project. I'm merely discussing the choices because it's an interesting subject.