Archived

This topic is now archived and is closed to further replies.

Nibbles

Loading certain info from file

Recommended Posts

Hi, Say i have data stored in a file such as: Number1 = 134 Number2 = 21 Number3 = 6516 if it where only: 134 21 6516 I could do it, but how do I load only the value? Such as in a .cfg or .ini file? Thanks, Scott

Share this post


Link to post
Share on other sites
Windows (the Win32 API) has special functions for processing the registry/.ini files:

Registry Functions


RegCloseKey
RegConnectRegistry
RegCreateKey
RegCreateKeyEx
RegDeleteKey
RegDeleteValue
RegEnumKey
RegEnumKeyEx
RegEnumValue
RegFlushKey
RegGetKeySecurity
RegLoadKey
RegNotifyChangeKeyValue
RegOpenKey
RegOpenKeyEx
RegQueryInfoKey
RegQueryMultipleValues
RegQueryValue
RegQueryValueEx
RegReplaceKey
RegRestoreKey
RegSaveKey
RegSetKeySecurity
RegSetValue
RegSetValueEx
RegUnLoadKey

Obsolete Functions (These deal with .ini files)


GetPrivateProfileInt
GetPrivateProfileSection
GetPrivateProfileSectionNames
GetPrivateProfileString
GetPrivateProfileStruct
GetProfileInt
GetProfileSection
GetProfileString
WritePrivateProfileSection
WritePrivateProfileString
WritePrivateProfileStruct
WriteProfileSection
WriteProfileString

Share this post


Link to post
Share on other sites
tokenize the file as you read it in i.e. tok1 = "Number1" tok2 = "=" tok3 = "134" and create rules for what to do when you ecounter a certain token i.e. if token has this format "NumberX" take next token ("=") and apply the following token ("134") to it.

heh, or what oluseyi said if using the proper files for storing/loading values...

Share this post


Link to post
Share on other sites