What are ini files?

Blitz3D Forums/Blitz3D Beginners Area/What are ini files?

MattVonFat(Posted 2004) [#1]
This may sound like a dumb question but i have seen them but never actually tried to work out what they do. Some one mentioned it so i decided to find out. So if anyone can help please post.

Thanks

MattVonFat


CS_TBL(Posted 2004) [#2]
uh .. usually ppl use .ini files to store certain global variables, like paths.

If you have eurora as email-application, check out eudora.ini .. it also holds lotsof info (your email settings!), info that you typically want to store in a file that's readable by us human beings..

I once made a little Boulderdash clone in B+, I stored the mapwidth, mapheight and framerate in an ini-file that I automaticaly load at game startup. This way I can vary the size of the map 'outside' the source, meaning that I don't need to recompile the project.


Agamer(Posted 2004) [#3]
kwl but couldn't you just use a *.txt file for that.


CS_TBL(Posted 2004) [#4]
which is the same :)

".ini" makes more sense to me as it describes 'initial values'.


MattVonFat(Posted 2004) [#5]
ah ok, thanks!


Rob Farley(Posted 2004) [#6]
Clicky

I created an ini file updater thingy here. It might be usful to you if you start using ini files


xmlspy(Posted 2004) [#7]
.


Agamer(Posted 2004) [#8]
rob can I use that peiece of code in a game I am making possibly comercial!


MattVonFat(Posted 2004) [#9]
thanks for the help rob, that script has made it easier to understand!


Agamer(Posted 2004) [#10]
I have e-mailed u!


augGa(Posted 2004) [#11]
Using Ini files as a Limited *DataBase*...
Ini files are basically INDEXED files not text files..
Main Key= Section Name
Sub Key = Section Detail (You can create this key)
e.g.,
Assume you want to store the *Last Played* data for each person who has used your app..
want to keep..Date played,mins played, highest score...

[MyAppPlayed] ---- Section Name/Key
Tommy Roe=20040507,45 Mins,Score 125 (Key is Tommy Roe)
Mickey Mouse=20040508,180 Mins,Score 1120
etc,,
API: GetPrivateProfileString("myAppPlayed",
"Tommy Roe",
"Not Found", (Default return)
RtnString,
1024,
"C:\...\MyIniFileName.ini")
returns 20040507,45 Mins,Score 125
You would have to parse out the CSV fields (assuming you have more than one)

The API can also return All sub keys to allow you to loop through them... i.e.,
GetPrivateProfileString("myAppPlayed",
Null,
"Not Found", (Default return)
RtnString,
1024,
"C:\...\MyIniFileName.ini")
rtn String contains Tommy Roe/Null/Mickey Mouse/Null/ etc..

And of Course INI files can contain Many Different Sections. The Only limitation that I can recall is that they (Ini) must be <= 64KB in size...
Store data using the API.. WritePrivateProfileString ...
They are quite easy to use and can be quite powerful if you have the need for simple indexed app..


Agamer(Posted 2004) [#12]
thx for the reply