Exception thrown while trying to read file

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 3 08:07:03 PDT 2014


On Fri, 03 Oct 2014 14:19:23 +0000
Matt via Digitalmars-d-learn <digitalmars-d-learn at puremagic.com> wrote:

also you can use my iv.io module to reading binary numbers:
http://repo.or.cz/w/iv.d.git/blob_plain/HEAD:/io.d

like this:

  auto offs = file.readNum!uint();

this is endian-safe too (in the sense that it assumes that file data is
little-endian).

or, if you want to do it dirty, replace your readf with this:

  file.rawRead((&offs)[0..1]);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141003/27e93043/attachment.sig>


More information about the Digitalmars-d-learn mailing list