[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] sorry wrong topic - DATA FILES
Hi,
I would guess getAllInt16 is no longer implemented. I'm not sure. I should
change the example.
Read the next section. I think working with interpreted strings is easier
anyway, because you can edit the file using any text editor.
var fp, data;
fp = File("TestInt", "w");
data = "[65, 66, 67, 68, 69, 70, 71]";
fp.write(data);
fp.close;
var fp, data;
fp = File("TestInt", "r"); //open a file
fp.length;
data = fp.readAllString.interpret;
data.postln;
data.at(0).postln;
fp.close;
Note that the code below also works, but data is now a string, not an array
of integers (as illustrated by data.at(0), which is the character "["). The
.interpret translates the string into code, i.e. an array of integers.
var fp, data;
fp = File("TestInt", "r"); //open a file
fp.length;
data = fp.readAllString;
data.postln;
data.at(0).postln;
fp.close;