Page 1 of 1

Preferences/INI

Posted: Wed Jul 23, 2008 12:30 pm
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?

Posted: Wed Jul 23, 2008 2:31 pm
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

Posted: Wed Jul 23, 2008 4:38 pm
by moogle
thank youuuu!! why does the msdn not say this!!!

Posted: Sat Jul 26, 2008 8:36 pm
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.