File I/O - rawWrite issues

Carl myemail at mysite.com
Wed May 8 14:33:58 PDT 2013


I am learning D so I thought this would be the correct place for 
this question (I assume I am making an error, not the compiler).

I am writing arrays of ubytes using rawWrite to a file. Whenever 
I write arrays full of numbers I have no problems, but once I 
write an array with zeroes I can then no longer write to that 
file.

For example:
ubyte[] data = [5, 34, 9, 45];
file.rawWrite(data); // OKAY

ubyte[] data = [0, 0, 0, 45];
file.rawWrite(data); // NOT OKAY


I get no errors or exceptions, it just won't write the array. I 
can't even open a new file stream and write, not even after 
rerunning the program. My only guess is some kind of string 
related problem where '\0' causes it to terminate.

Thanks in advance.



P.S. DMD, Ubuntu 11


More information about the Digitalmars-d-learn mailing list