Reading a structured binary file?

Jonathan M Davis jmdavisProg at gmx.com
Sat Aug 3 11:54:44 PDT 2013


On Saturday, August 03, 2013 20:23:55 Gary Willoughby wrote:
> On Saturday, 3 August 2013 at 18:14:47 UTC, Gary Willoughby wrote:
> > This sounds a great idea but once the file has been opened as a
> > MmFile how to i convert this to a ubyte[] so the std.bitmanip
> > functions work with it?
> 
> I'm currently doing this:
> 
> 	auto file = new MmFile("file.dat");
> 	ubyte[] buffer = cast(ubyte[])file[];
> 	buffer.read!uint(); //etc.
> 
> Is this how you would recommend?

Yeah. That's how you do it.

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list