I\'ve got a part of my memory that I want to dump to a file. One reason is to save the information somewhere, and another is to read it again when my program restarts.
The proper way of doing that is to use a serialisation library.
Whether you really need that depends on the complexity of your data. If the data you need to write out does not contain any pointers of any kind, then you could just use fwrite to write the data out and fread to read it back in. Just make sure that you have opened the file with the data in binary mode.
If the data to serialise contains pointers, you are way better of using an external library written for this purpose, as the library will ensure that the pointers get written in such a way that they can be properly reconstructed later.