how to raw read a struct or value?
Graham Fawcett
fawcett at uwindsor.ca
Thu Jul 14 06:36:47 PDT 2011
On Thu, 14 Jul 2011 09:01:29 +0000, hasnoth wrote:
> auto file = io.File("test.txt", "rb");
> auto fp = file.getFP();
> int x;
> io.fread(&x, x.sizeof, 1, fp);
>
> what's the d method to do that?
The same method:
import core.stdc.stdio : fread;
fread(&x, x.sizeof, 1, fp);
or, if you are using an array, you can use File.rawRead:
int[10] xx;
f.rawRead(xx);
Graham
More information about the Digitalmars-d-learn
mailing list