Server Help

Bot Questions - WritePrivateProfileString and GetPrivateProfileString

Quan Chi2 - 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.
Mr Ekted - 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().
Maverick - 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
Code: Show/Hide
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

Code: Show/Hide
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
Maverick - Sat Nov 12, 2005 2:49 pm
Post subject:
bah ekted! sa_tongue.gif
Quan Chi2 - Sat Nov 12, 2005 4:46 pm
Post subject:
Heh, thanks guys.. Mav, I searched and saw that page and didnt understand lol.
Cyan~Fire - 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++.
Quan Chi2 - 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.
Cyan~Fire - 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. icon_confused.gif
All times are -5 GMT
View topic
Powered by phpBB 2.0 .0.11 © 2001 phpBB Group