Basic Profile Filetest Not Working, Need Help!


Quiest

I like turtles!
Joined
Sep 2, 2004
Messages
3,411
Age
40
Location
Dteuschland ;)
Here is the code I made to test a profile file:

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?
 
Okay, then I have to learn how structs work :D

Does anyone has a link to a tutorial/information/documentation or something?
 
Woo, just found that old serie of tutorials that I thought went offline years ago! Best DIV tutorials you can get anywhere, check the site here.

Some of the adresses of the tutorials are pointing towards netsoc.blabla.ie or something, just remember the name of the html file and add that in crystal.sphosting.com/main/tutorials/blabla.html. Struct tutorial can be found here.

Just saved me another long post :p .
 
Thanks alot! I got the profile system basicly working without using structs now (heavy converting of numbers to letters :D), but thanks anyways, since it can never be bad to learn more about structs :D
 
Back
Top