[bug?] File() object writefloat32()
Oct 13 2014 | 6:17 am
I am trying to write some data to a textile and am looking at the new File() object. If I run the following code I get some behaviour I can not explain:
function writefile(s) { var patcherDir = this.patcher.filepath.replace(patcher.name+".maxpat", ""); post(patcherDir, "\n") var f = new File(patcherDir + "testFile.txt","write","TEXT"); var s2 = "dataName.54"; var s3 = "size " + 74; var s4 = [0.0, 1.1, 2.2, 3.3, 4.4, 5.5]; if (f.isopen) { f.writeline(s2); f.writeline(s3); f.writefloat32(s4); f.close(); } else { post("could not create file: " + s + "\n"); } }
here is what the resulting textile looks like:
dataName.54 size 74 ÕÃå?ÕÃ@33S@ÕÃå@∞@
Am I misunderstanding how the writefloat32() function is supposed to be used or is this a bug?
I am trying to encode a mix of int and float data in the end. Would it be better to stringify it all?
Thanks