Preferences/INI

Windows specific forum
moogle
Enthusiast
Enthusiast
Posts: 372
Joined: Tue Feb 14, 2006 9:27 pm
Location: London, UK

Preferences/INI

Post by moogle »

I'm using the following code

http://www.purearea.net/pb/CodeArchiv/F ... d&Write.pb

But when using this code

Code: Select all

Datei.s = "games.ini" 

Debug Pref_ReadString("Version","Version",Datei)
with this ini

http://www.mediafire.com/?nfnhtmixmmv

But it seems to not be able to read the number. If the ini is shorter it gets the number but it just can't seem to get it here. Is this a bug in the WinAPI or the code or PB?
Image
ebs
Enthusiast
Enthusiast
Posts: 563
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

The maximum size for a Windows .INI file is 64 KB, according to Microsoft:
http://support.microsoft.com/kb/q78346/

The Windows API can't handle your .INI file, which is over 560 KB.

However, the native PureBasic 4.20 Preference functions work correctly!

Code: Select all

Datei.s = "games.ini"

OpenPreferences(Datei)
PreferenceGroup("Version")
Debug ReadPreferenceString("Version","")
ClosePreferences()
Regards,
Eric
moogle
Enthusiast
Enthusiast
Posts: 372
Joined: Tue Feb 14, 2006 9:27 pm
Location: London, UK

Post by moogle »

thank youuuu!! why does the msdn not say this!!!
Image
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

The max size limit for a .txt file to be read in windows with the native windows notepad is 64 KB. An .ini file is just a .txt file with the extension changed. So windows sets its .txt file size to 64 KB max. Anything over that requires a seperate reader coded to read it if its over 64kb. The PB commands are not limited by the 64 kb restriction but the native API is. The MSDN doesn't say it because MS assumes that if your going to be using strictly API that your also going to be using the coding conventions that MS intended which includes the 64 KB limit.
Post Reply