We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Save/load bytes and strings
Page Index Toggle Pages: 1
Save/load bytes and strings (Read 532 times)
Save/load bytes and strings
Mar 14th, 2010, 11:49pm
 
hi
could anyone help me with that problem.
I now tried to use save/load for many hours but didn't understand it.
First I saved it in the sketch folder and then I tried to use it, but
Quote:
The file "highscore.dat" is missing or inaccessible, make sure the URL is valid or that the file has been added to your sketch and is readable.

is always coming.

Code:
byte hsB[]= /*new byte[4];*/loadBytes("highscore.dat");



void setup(){
background(0);
size(700,500);
frameRate(1);
println(hsB);
/*for(int j=0; j<4; j++){
hsB[j]= byte(500-(j*100));
}
saveBytes("highscore.dat", hsB);*/
}
Re: Save/load bytes and strings
Reply #1 - Mar 15th, 2010, 2:45am
 
That's because Processing saves in the current folder, but it reads on the data folder...
Simple solution (hard to find...):
saveBytes(dataPath("highscore.dat"), hsB);
Not sure if it works with exported file. Alternative:
byte hsB[]= loadBytes(sketchPath("highscore.dat"));
Page Index Toggle Pages: 1