loadBytes()Input/OutputFilesWeb & Application
// open a file and read its binary data
byte b[] = loadBytes("something.dat");
// print each value, from 0 to 255
for (int i = 0; i < b.length; i++) {
// every tenth number, start a new line
if ((i % 10) == 0) {
println();
}
// bytes are from -128 to 127, this converts to 0 to 255
int a = b[i] & 0xff;
print(a + " ");
}
// print a blank line at the end
println();
Reads the contents of a file or url and places it in a byte array. If a file is specified, it must be located in the sketch's "data" directory/folder.
loadBytes(filename);
String: name of a file in the data folder or a url.byte[]
loadStrings()
saveStrings()
saveBytes()
1.0FunctionCoreExtended