jeudi 26 février 2015

How do I write binary data to a file in Modern C++?

Writing binary data to a file in C is simple: use fwrite, passing the address of the object you want to write and the size of the object. Is there something more "correct" for Modern C++ or should I stick to using FILE* objects? As far as I can tell the IOStream library is for writing formatted data rather than binary data, and the write member asks for a char* leaving me littering my code with casts.


Aucun commentaire:

Enregistrer un commentaire