how to set linebreak property in file object

volker böhm's icon

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
            f.writeline("abc");
        }
        f.close();
    } else {
        post("could not create file: " + s + "n");
    }
}

Joshua Kit Clayton's icon

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

volker böhm's icon

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