Quiest
I like turtles!
Here is the code I made to test a profile file:
Now, everytime I run, if there is a profiles.dat or not, it gets rewritten. Any idea, why? Help me, please!
EDIT: After taking a closer look, it doesn`t seem fenix saves an array if its string.
This code works if I just put in integers instead of strings.
Anyone know a workaround, or a way to save strings to a file in Fenix?
Code:
program menu_profiles;
global
string menu_profiles[12];
private
profile_nr=0;
profile_max=10;
profile_x=20;
profile_y=15;
flag=0;
begin
load("profiles.dat",menu_profiles);
if(menu_profiles[12]!="full") //here the code should detect if there is no profiles.dat"
while(profile_nr<profile_max)
profile_nr++;
menu_profiles[profile_nr]="empty"; //every profile gets named "empty"
if(profile_nr==10) //if all profiles are now "empty",
flag=1;
end;
end;
end;
if(flag==1)
menu_profiles[12]="full"; //set the "detector" to "full"
write(0,200,5,0, "new profile.dat saving!"); //tell that the new file is being saved
frame;
save("profiles.dat",menu_profiles); //save the file
end;
profile_nr=0;
while(profile_nr<profile_max) //display array[1] to [10]
profile_nr++;
write_var(0,profile_x,profile_y,0, menu_profiles[profile_nr]);
profile_y+=15;
end;
loop
frame;
end;
end;
Now, everytime I run, if there is a profiles.dat or not, it gets rewritten. Any idea, why? Help me, please!
EDIT: After taking a closer look, it doesn`t seem fenix saves an array if its string.
This code works if I just put in integers instead of strings.
Anyone know a workaround, or a way to save strings to a file in Fenix?