C++ Structure: How do I write a structure to a file?


/ Published in: C++
Save to your folder(s)

Q: How do I write a structure to a file?

A: You can easily write a structure to a file as long as the structure is what is known as a POD (Plain Old Data) type. This means that all members of the structure must be of a fixed size, which implies that the structure can not contain pointers. This stipulation goes for all members of the structure. Look at these examples:

URL: http://www.codeguru.com/forum/showthread.php?t=269648

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.