ini-file

sloopa

Member
Licensed User
i am just to lazy... so don't stress your mind!
(i will find a solution myself)

but if a solution exists:

has somebody a solution for a configuration-file like an ini-file?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It should be pretty easy.
B4X:
[SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][SIZE=2]Globals[/SIZE]
 
[SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]Sub [/COLOR][/SIZE][SIZE=2]App_Start[/SIZE]
[SIZE=2]Form1.Show[/SIZE]
[SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]FileExist[/COLOR][/SIZE][SIZE=2]("myapp.ini") = true then [/SIZE]
[SIZE=2][COLOR=#0000ff] FileOpen[/COLOR][/SIZE][SIZE=2](c1,"myapp.ini",cRead)[/SIZE]
[SIZE=2] parameter1 = [/SIZE][SIZE=2][COLOR=#0000ff]FileRead[/COLOR][/SIZE][SIZE=2](c1)[/SIZE]
[SIZE=2] parameter2 = [/SIZE][SIZE=2][COLOR=#0000ff]FileRead[/COLOR][/SIZE][SIZE=2](c2)[/SIZE]
[SIZE=2][COLOR=#008000] '...[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff] FileClose[/COLOR][/SIZE][SIZE=2](c1)[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]if[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]End Sub[/COLOR][/SIZE]
 
[SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE][SIZE=2] Form1_Close[/SIZE]
[SIZE=2][COLOR=#0000ff]FileOpen[/COLOR][/SIZE][SIZE=2](c1,"myapp.ini",cWrite)[/SIZE]
[SIZE=2][COLOR=#0000ff]FileWrite[/COLOR][/SIZE][SIZE=2](c1,parameter1)[/SIZE]
[SIZE=2][COLOR=#0000ff]FileWrite[/COLOR][/SIZE][SIZE=2](c1,parameter2)[/SIZE]
[SIZE=2][COLOR=#008000]'...[/COLOR][/SIZE]
[SIZE=2][COLOR=#0000ff]FileClose[/COLOR][/SIZE][SIZE=2](c1)[/SIZE]
[SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Sub[/COLOR][/SIZE]
 

Cableguy

Expert
Licensed User
Longtime User
Hi,

I adressed a similar issue in the old forum were when my app started it searched for a language config file and load it's contents...If usefull i'll re-write my code sample and post it...
 

sloopa

Member
Licensed User
Hi CableGuy

you're welcome (to send the code :) )
 

Cableguy

Expert
Licensed User
Longtime User
Here's my sample code for the above issue, hope it helps..
 

Attachments

  • test.zip
    1.1 KB · Views: 361

RandomCoder

Well-Known Member
Licensed User
Longtime User
This advice has also helped me, I'm wanting to create a high scores table for my Splat Master game which I showed in the old Forum. With a bit of luck I'll have this done in next to no time now and then I'll post my code again for you all to enjoy. It's bigger and better now :sign0098:

Thanks,
RandomCoder
 
Top