New to D: parse a binary file
bearophile
bearophileHUGS at lycos.com
Sun Feb 6 13:08:28 PST 2011
scottrick:
> Where is the function 'format' defined?
You need to add at the top of the module:
import std.conv: format;
Or:
import std.conv;
> Also, what is that 'unittest' block? It compiles fine as is, but if I refer to format outside of
> unittest, it will not compile. Also, if I compile and run your
> example, it doesn't do anything, since main() is empty?
It's an block of unit tests :-) Currently in your program they are not even compiled, so the format is not used. To run the unit tests you need to compile with -unittest compiler switch (with DMD).
See also:
http://www.digitalmars.com/d/2.0/unittest.html
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list