Reading file as binary

Ali Çehreli acehreli at yahoo.com
Wed May 29 22:39:05 PDT 2013


On 05/29/2013 09:00 PM, baws wrote:

> Erhm, why isnt this compiling guys? all i did was add your
> suggestions... :/

Your code compiles here with dmd 2.062 and v2.063-devel-f6d55a9-dirty. 
What is the compiler error in your case?

The program has a run time error though: args[1] is an invalid access 
when args has only one element. Also, you are making an incorrect 
assumption: Unlike C, the last element of args is not null; such an 
element simply does not exist. You need a check like this:

     if (args.length != 2) {
         // ...
     }

Ali



More information about the Digitalmars-d-learn mailing list