Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


INI Files?

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
oib111
I post too much
Reputation: 0

Joined: 02 Apr 2007
Posts: 2947
Location: you wanna know why?

PostPosted: Tue Sep 25, 2007 8:10 pm    Post subject: INI Files? Reply with quote

I was using this article on using .ini files(http://functionx.com/bcb/howto/inifile.htm). But in there examples it doesn't do much. It only gives examples on how to read specific values :

Code:

void __fastcall TForm1::FormCreate(TObject *Sender)
{
    TIniFile *StartUp = new TIniFile("IValues.ini");

    // The FormPos section
    Left = StartUp->ReadInteger("FormPos", "Left", 250);
    Top  = StartUp->ReadInteger("FormPos", "Top",  200);

    // The controls values section
    edtPreview->Text   = StartUp->ReadString("CtlValues",  "txtPreview", "Euzhan Palcy");
    cboFonts->Text     = StartUp->ReadString("CtlValues",  "FontSelected", "Times New Roman");
    cboFontSizes->Text = StartUp->ReadString("CtlValues",  "FontSize", "24");
    scrRed->Position   = StartUp->ReadInteger("CtlValues", "RedPos", 0);
    scrGreen->Position = StartUp->ReadInteger("CtlValues", "GreenPos", 0);
    scrBlue->Position  = StartUp->ReadInteger("CtlValues", "BluePos", 0);

    delete StartUp;


As you can see it is reading specific values out of the .ini file, I want to know just how to read values, not a specific value like 250. I also am confused if ReadInteger/ReadString is for writing, I'm pretty sure its for reading as the name states, but I'm not sure because of this quote from the article.

C++ Builder Tutorial - INI Files wrote:

To create and manage the sections that make up an INI file, the TIniFile provides a series of methods such as ReadSection() and ReadSections(). To create and manage the strings of an INI file, you use the methods of the parent class TCustomIniFile. When creating the strings, you use Read() methods.

Here is an example:

//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
TIniFile *StartUp = new TIniFile("IValues.ini");

Left = StartUp->ReadInteger("FormPos", "Left", 250);
Top = StartUp->ReadInteger("FormPos", "Top", 200);

delete StartUp;
}
//---------------------------------------------------------------------------

To retrieve the values of the strings, you use Write() methods. Here is an example:

//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
TIniFile *StartUp = new TIniFile("IValues.ini");

StartUp->WriteInteger("FormPos", "Left", Left);
StartUp->WriteInteger("FormPos", "Top", Top);

delete StartUp;
}
//---------------------------------------------------------------------------


As you can see it is saying to retrieve values with Write() and creating the stuff with Read(), but I mean that would be stupid names, so I would just like some clarifications and once again if anyone has some specific .ini file tutorials for C++ it would be nice.

_________________


8D wrote:

cigs dont make people high, which weed does, which causes them to do bad stuff. like killing
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Trow
Grandmaster Cheater
Reputation: 2

Joined: 17 Aug 2006
Posts: 957

PostPosted: Wed Sep 26, 2007 12:17 am    Post subject: Reply with quote

I have no idea what you are *exactly* looking for, but I've been using readprivateprofilestring and writeprivateprofilestring for a long time now.
_________________
Get kidnapped often.
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Sep 26, 2007 3:50 am    Post subject: Reply with quote

http://www.codeproject.com/cpp/CIni.asp

As for the code you posted, my guess is that it's not reading the specific value but instead...
Code:
    Left = StartUp->ReadInteger("FormPos", "Left", 250);


That would be looking at the INI for '[FormPos]' and the key would bey 'Left' the default value if it was not found would be 250, but it would use the value that Left equals if one was one.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites