Exception thrown while trying to read file

Matt via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 3 07:19:23 PDT 2014


On Friday, 3 October 2014 at 13:48:41 UTC, thedeemon wrote:
> On Friday, 3 October 2014 at 11:30:02 UTC, Matt wrote:
>> I am building a PE-COFF file reader
>>  file.seek(0x3c, SEEK_SET);
>>  file.readf("%d", &offs); // this is the problem line
>> Does anyone else see whatever it is that I'm doing wrong?
>
> readf is for reading text, it expects to see some digits. 
> You're reading a binary file, not a text, so no ASCII digits 
> are found in that place. Use rawRead instead of readf.

much obliged, many thanks


More information about the Digitalmars-d-learn mailing list