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 


[C++] Reading INI Files

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

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Tue Mar 11, 2008 6:27 pm    Post subject: [C++] Reading INI Files Reply with quote

I'm making a Win32 Console app in Visual C++ 2008, and I want to read all strings from an INI file. How can I do this?
_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Mar 11, 2008 6:50 pm    Post subject: Reply with quote

GetPrivateProfileString :: http://msdn2.microsoft.com/en-us/library/ms724353(VS.85).aspx :: For Strings
GetPrivateProfileInt :: http://msdn2.microsoft.com/en-us/library/ms724345.aspx :: For Integers

_________________
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Tue Mar 11, 2008 6:54 pm    Post subject: Reply with quote

lurc wrote:
GetPrivateProfileString :: http://msdn2.microsoft.com/en-us/library/ms724353(VS.85).aspx :: For Strings
GetPrivateProfileInt :: http://msdn2.microsoft.com/en-us/library/ms724345.aspx :: For Integers

Alright, thanks. Smile

Edit: Okay, it's working. Now, how can I dynamically read every string?

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Tue Mar 11, 2008 7:38 pm    Post subject: Reply with quote

Read Multiple times, on different keys?
_________________
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Tue Mar 11, 2008 7:41 pm    Post subject: Reply with quote

lurc wrote:
Read Multiple times, on different keys?

Basically a foreach statement to execute code with each key.

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
hcavolsdsadgadsg
I'm a spammer
Reputation: 26

Joined: 11 Jun 2007
Posts: 5801

PostPosted: Tue Mar 11, 2008 10:44 pm    Post subject: Reply with quote

Array of names of things to read.
Back to top
View user's profile Send private message
Pseudo Xero
I post too much
Reputation: 0

Joined: 16 Feb 2007
Posts: 2607

PostPosted: Tue Mar 11, 2008 11:28 pm    Post subject: Reply with quote

slovach wrote:
Array of names of things to read.

Well, what I'm trying to make should allow the user to add as many entries as they want.

_________________
haxory' wrote:
can't VB do anything??
windows is programmed using VB right? correct me if im wrong.

so all things in windows you have like the start menu is a windows form too.
Back to top
View user's profile Send private message
dephreeze
Cheater
Reputation: 0

Joined: 06 Oct 2006
Posts: 33

PostPosted: Wed Mar 12, 2008 4:59 am    Post subject: Reply with quote

Xenophobe wrote:
Well, what I'm trying to make should allow the user to add as many entries as they want.


Vector?
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 Mar 12, 2008 2:22 pm    Post subject: Reply with quote

I would go with a vector also. Along with strings:

Code:

#include <string>
#include <vector>

struct IniEntry
{
    std::string strKey;
    std::string strName;
    std::string strValue;
};
std::vector<IniEntry> cIniEntries;


You can add a new entry to cIniEntries using the vector command, push_back such as:

Code:
IniEntry iEntry;
iEntry.strKey = "keyname";
iEntry.strName = "item_name";
iEntry.strValue = "value";
cIniEntries.push_back( iEntry );

_________________
- Retired.
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