Author |
Message |
Quan Chi2 Member of "Sexy Teenagers that Code" Group

Age:34 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
Posted: Sat Nov 12, 2005 8:55 am Post subject: WritePrivateProfileString and GetPrivateProfileString |
 |
|
|
|
I searched for a detailed tutorial on how to use these functions and got no success.
Can someone direct me to a website that tells me exactly how I would use these functions in a code? I've seen it before from the rankbot plugin but I need a break down on what everything means and how to plug each line into the code. |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sat Nov 12, 2005 2:42 pm Post subject: |
 |
|
|
|
GetPrivateProfileString(section, key, default, buffer, bufsize, inifile);
Here's the INI file ekted.ini in the "current directory":
[section1]
one=hello
two=world
[section2]
one=you
two=suck
If you want the string for "[section1] two", you would do:
char buf[256];
GetPrivateProfileString("section1", "two", "some default string", buf, sizeof(buf), ".\\ekted.ini");
If you expect to get a value back, you use the same function and then use atoi() or atof(). _________________ 4,691 irradiated haggis! |
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Sat Nov 12, 2005 2:48 pm Post subject: |
 |
|
|
|
http://www.google.com/search?q=WritePrivateProfileString
http://www.google.com/search?q=GetPrivateProfileString
It comes down to
BOOL WritePrivateProfileString(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
LPCTSTR lpString,
LPCTSTR lpFileName
); |
lpAppName = the name of the [key] in the .ini file.
lpKeyName = the name of the Key=... value in the .ini value
lpString = the value that needs to be writtened to the key
lpFileName = the filename of the .ini file that needs to be modified
DWORD GetPrivateProfileString(
LPCTSTR lpAppName,
LPCTSTR lpKeyName,
LPCTSTR lpDefault,
LPTSTR lpReturnedString,
DWORD nSize,
LPCTSTR lpFileName
); |
http://wiki.minegoboom.com/index.php/MERVBot_Tutorial#Input_with_GetPrivateProfileString
lpAppName = the [key] name
lpKeyName = the name of the Key=... value in the .ini value
lpDefault = the value returned to lpReturnedString when the key/App/file is not found.
lpReturnedString = the result of the operation is written to this variable
nSize = the size of the lpReturnedString
lpFileName = the file name of the .ini file
It ain't that hard, you know _________________
|
|
Back to top |
|
 |
Maverick

Age:40 Gender: Joined: Feb 26 2005 Posts: 1521 Location: The Netherlands Offline
|
Posted: Sat Nov 12, 2005 2:49 pm Post subject: |
 |
|
|
|
bah ekted!  |
|
Back to top |
|
 |
Quan Chi2 Member of "Sexy Teenagers that Code" Group

Age:34 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
Posted: Sat Nov 12, 2005 4:46 pm Post subject: |
 |
|
|
|
Heh, thanks guys.. Mav, I searched and saw that page and didnt understand lol. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Nov 13, 2005 12:55 am Post subject: |
 |
|
|
|
Which is why you shouldn't even try writing a MERVBot plugin before you learn C++. _________________ This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him. |
|
Back to top |
|
 |
Quan Chi2 Member of "Sexy Teenagers that Code" Group

Age:34 Gender: Joined: Mar 25 2005 Posts: 860 Location: NYC Offline
|
Posted: Sun Nov 13, 2005 8:11 am Post subject: |
 |
|
|
|
No.. Who told you that? These are just two functions I didn't know how to use. Im pretty cool with fstreams, but I feel that these look way easyier. Give me a break already.. Anyway, I know WritePrivateProfileString now. Now to use GetPrivateProfileString. |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Sun Nov 13, 2005 11:37 am Post subject: |
 |
|
|
|
I told myself that. It must be hard to understand C docs when you don't understand english.  |
|
Back to top |
|
 |
|