FAQ
 
 
Cover  \ Exhibition  \ Learning  \ Reference  \ Download  \ Discourse   
      Language \ Environment \ Libraries \ Comparison
 
   
   
Abridged (A-Z) \ Complete (A-Z)  
   
  Reference for Processing (BETA) version 91+. If you have a previous version, use the reference included with your software. If you see any errors or have any comments, let us know.  
Name  

loadBytes()

   
Examples  
// 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(); 
 

Description   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.
   
Syntax  
loadBytes(filename);
   
Parameters  
filename   String: name of a file in the data folder or a URL.

   
Returns   byte[]
   
Usage   Web & Application
   
Related   loadStrings()
saveStrings()
saveBytes()
 
 






   
 
Updated: Fri Jul 15 16:35:44 PDT 2005
 
 








Creative Commons License
 
  Processing is an open project initiated by Ben Fry and Casey Reas  
  © Info