Re: How can I serialize a struct into a file in the style of C?

2017-07-23 Thread Temtaime via Digitalmars-d-learn
Hi ! I have a dub package that doing this. https://github.com/Temtaime/tt-utils/blob/master/source/tt/binary/tests.d Have a look at the tests. Currently it has no documentation, but feel free to ask questions

Re: How can I serialize a struct into a file in the style of C?

2017-07-22 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 23 July 2017 at 02:07:45 UTC, solidstate1991 wrote: Well, it seems the toStringz() function adds a few garbage characters to the end of the filename How are you using it? The only character it should be adding is the zero terminator. I suspect you might be using it on a static

Re: How can I serialize a struct into a file in the style of C?

2017-07-22 Thread solidstate1991 via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:22:53 UTC, Mike Parker wrote: I should add, though, that you're better off using either std.stdio.File or std.file. Use the former if you need to make multiple reads/writes to a file, the latter if you can pull it in or push it out all in one go. They take

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 02:11:27 UTC, Mike Parker wrote: On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many

Re: How can I serialize a struct into a file in the style of C?

2017-07-21 Thread Mike Parker via Digitalmars-d-learn
On Saturday, 22 July 2017 at 01:45:29 UTC, solidstate1991 wrote: Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same

How can I serialize a struct into a file in the style of C?

2017-07-21 Thread solidstate1991 via Digitalmars-d-learn
Due to it's convenience, I was thinking on reading and writing file headers by creating structs mirroring the layouts of actual headers I would need. I've seen many examples of this in C, however I' struggling using the same methods through the use of code.stdc.stdio, especially as I can't