On 2014-06-24 1:46 PM, H. S. Teoh via Digitalmars-d wrote:
Easy:
auto f = File(myDataFile, "r");
f.seek(someOffset);
ubyte[] buf;
buf.length = sizeOfData;
ubyte[] dataRead = f.rawRead(buf);
if (dataRead.length != sizeOfData)
throw new Exception("Unexpected truncated data");
// do whatever you want with dataRead
Hope this helps.
And yes, the documentation should use some improvement. A lot of
improvement even. :P Please feel free to submit a pull request, or at
least file a bug against the docs.
T
Well, that solves it for me ;)
I think the documentation could use more code samples, and a smarter
table of contents. e.g. http://dlang.org/phobos/std_stdio.html clicking
on the "read" keyword redirects to... enum LockType.read
There's no mention about reading in the struct File; example
ugh :/