Forums > Javascript

how to set linebreak property in file object

March 25, 2006 | 11:34 am

hi again,
i would like to set the linebreak property of the file object to
something different than "native", to hopefully end up with a NL
character (ascii 10) at the end of a text line i create with writeline
(), rather than a CR (ascii 13).

maybe someone can point me to where i go wrong.
thanks,
volker.

function writefile(s)
{
var f = new File(s,"write","TEXT");
post(f.linebreak, "n");
f.linebreak = "unix";
post(f.linebreak, "n");
if (f.isopen) {
for(i=0;i<3;i++){
f.writeline("abc");
}
f.close();
} else {
post("could not create file: " + s + "n");
}
}


March 25, 2006 | 5:24 pm

Hi Volker,

Thanks for finding this bug in File (which also pointed to similar
problems with the byteorder attribute). These problems will be fixed
in the next release of Max, so for the time being you will need to
use the newline character in the written string, rather than the
writeline() method. For example:

myfile.writestring("foo barn");

Hope this helps.

-Joshua


March 25, 2006 | 7:05 pm

yap, that solves it for now.
thanks.
volker.


Viewing 3 posts - 1 through 3 (of 3 total)