[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [sc-users] sorry wrong topic - DATA FILES
Hi,
I'm having problems with cottle's data file example. I found a way to
retrieve the array back, but I'm a SC beginner then I probably went to the
most stupid and difficult way to do it. Anyone knows how to fix this
problem ?
Thanks! pb.
// cottle's example:
//writing array to data file
var fp, data;
fp = File("TestInt", "w"
data = [65, 66, 67, 68, 69, 70, 71];
data.do({arg eachInt; fp.putInt16(eachInt)});
fp.close;
//works fine
//getting the array back from file and placing the the variable data
var fp, data;
fp = File("TestInt", "r"); //open a file
data = fp.getAllInt16; //read all as Int array
data.postln;
fp.close;
// SC tells me Message " 'readAllInt16' not understood."
// my way
var fp, data;
fp = File("TestInt", "r"); //open a file
data= Array.fill(7,{ fp.getAllInt16 });
data.postln;
fp.close;