www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Re: A bit of binary I/O

Heinz Wrote:

 Chris Nicholson-Sauls Wrote:
 Heinz wrote:
 In C++ you can write an entire structure to a binary file:
 Can you do the same in D?

Sure, and it will work between instances of the program so long as none of the structure's members are referances: pointers, object variables, arrays. -- Chris Nicholson-Sauls

So, you mean i can't have this structure because i has an array? struct h { } Could you post an example please?

Sorry, i pressed tab and then enter and posted before i typed the struct, here it goes: struct h { int i = 4; char[] s = "hello"; bool b = false; }
Jan 20 2007