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:
 
 http://www.gamedev.net/reference/articles/article1127.asp
 http://www.codersource.net/cpp_file_io_binary.html
 
 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