New to D: parse a binary file

scottrick scottrick49 at hotmail.com
Sat Feb 5 09:26:00 PST 2011


Hi,

I am new to D.  I am trying to write a binary file parser for a
project of mine and I thought it would be fun to try and learn a new
language at the same time.  So I chose D!  :D  I have been
struggling however and have not been able to find very many good
examples, so I am posting this message.

I think I'm supposed to be using std.stdio, but I'm not 100% sure.
Could somebody post a short example of how to parse a couple of
characters and ints or whatever from a file?  Or how to read, say,
the next however many bytes into a struct?

Also, looking at the documentation, I am confused by this method
signature:

T[] rawRead(T)(T[] buffer);

I understand that T is generic type, but I am not sure of the
meaning of the (T) after the method name.

Thanks,


More information about the Digitalmars-d-learn mailing list