C++: Easy way to save a structure.

I tried it now many times and I don’t think I can get a solution. Could you pls send me an example?