File I/O - rawWrite issues
Ali Çehreli
acehreli at yahoo.com
Wed May 8 14:58:59 PDT 2013
On 05/08/2013 02:46 PM, Meta wrote:
>> For example:
>> ubyte[] data = [5, 34, 9, 45];
>> file.rawWrite(data); // OKAY
>>
>> ubyte[] data = [0, 0, 0, 45];
>> file.rawWrite(data); // NOT OKAY
>
> Since ubytes are pretty much the same as chars,
True from the point of view of sizes: they are both 8-bit wide. However,
they are different beasts: char is merely a UTF-8 code unit. ubyte does
not have such a meaning attached to it.
> I think writing 0 to the
> file will actually write the null character, which probably isn't a good
> thing.
I don't see any problem there. rawWrite() should just write 0.
I think Carl should provide a short program that demonstrates the
problem. :)
Ali
More information about the Digitalmars-d-learn
mailing list