Hyper
07-13-2009, 10:44 PM
I'm sure there's an easy answer to this, and I'm half asleep (which is probably why I'm post). This is rather easy to answer for anyone, and I'm quite aware that there's the Windows Registry but I don't want to use that. I want this to be more user-friendly, and I've recently realized that (like AutoIt), C++ has predefined *.ini control functions (or however you'd refer to that). Pretty much I can write/read specific strings from an *.ini file. I can write "Sections" (which are in brackets) and that's great! But say I wanted to write something that was X long (user defined and edited). Like...
[Messages]
1=Hi
2=How
3=Are
4=You?
You couldn't get 1-4 statically using GetPrivateProfileString, but with GetPrivateProfileSection you could! Because it runs through and collects them all (although I'm unsure how), which is why I'm posting here. :)
How do you extract the information from GetPrivateProfileSection?
Thanks in advance (I'm trying to figure out right now). :unsure:
----------------------------- EDIT ------------------------------------
for (int x = 0; x < 500; x++) {
printf("%c", test[x]);
if (test[x] == '\0') {
printf("\n"); // New line - the string ended
if (test[x + 1] == '\0') { break; }
}
}
Fixed! :) I'm such a retard... Thanks, sorry for the post.
It clearly states here (http://msdn.microsoft.com/en-us/library/ms724348(VS.85).aspx) on MSDN:
lpReturnedString [out]
A pointer to a buffer that receives the key name and value pairs associated with the named section. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.
Sorry for posting, thanks again!!! <3
[Messages]
1=Hi
2=How
3=Are
4=You?
You couldn't get 1-4 statically using GetPrivateProfileString, but with GetPrivateProfileSection you could! Because it runs through and collects them all (although I'm unsure how), which is why I'm posting here. :)
How do you extract the information from GetPrivateProfileSection?
Thanks in advance (I'm trying to figure out right now). :unsure:
----------------------------- EDIT ------------------------------------
for (int x = 0; x < 500; x++) {
printf("%c", test[x]);
if (test[x] == '\0') {
printf("\n"); // New line - the string ended
if (test[x + 1] == '\0') { break; }
}
}
Fixed! :) I'm such a retard... Thanks, sorry for the post.
It clearly states here (http://msdn.microsoft.com/en-us/library/ms724348(VS.85).aspx) on MSDN:
lpReturnedString [out]
A pointer to a buffer that receives the key name and value pairs associated with the named section. The buffer is filled with one or more null-terminated strings; the last string is followed by a second null character.
Sorry for posting, thanks again!!! <3