www.digitalmars.com         C & C++   DMDScript  

D - Linux version file write/append bug

reply Ant <Ant_member pathlink.com> writes:
Linux version file write/append bug

import file;

int main()
byte[] t;
t ~= 33;
t ~= 34;
file.write("test",t); // or file.append("test",t);
return 0;

both versions (write and append) will create a file
with 0 bytes.
Seems that phobos.file has:

numwritten = linux.write(fd, buffer, len);
if (len != numwritten)
goto err2;

but len never got initialized.

I changed file.d recompile and now it works fine.

(didn't know how to get the lenght from
OutBuffer.data - data.length doesn't work it has extra bytes (null) ???
I just pass the length to the write method in file)

Aug 31 2003
parent "Walter" <walter digitalmars.com> writes:
Thanks for catching this. I'll take care of it. -Walter
Aug 31 2003