| View previous topic :: View next topic |
| Author |
Message |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 6:27 pm Post subject: [C++] Reading INI Files |
|
|
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 |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 6:54 pm Post subject: |
|
|
Alright, thanks.
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 |
|
 |
lurc Grandmaster Cheater Supreme
Reputation: 2
Joined: 13 Nov 2006 Posts: 1900
|
Posted: Tue Mar 11, 2008 7:38 pm Post subject: |
|
|
Read Multiple times, on different keys?
_________________
|
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 7:41 pm Post subject: |
|
|
| 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 |
|
 |
hcavolsdsadgadsg I'm a spammer
Reputation: 26
Joined: 11 Jun 2007 Posts: 5801
|
Posted: Tue Mar 11, 2008 10:44 pm Post subject: |
|
|
| Array of names of things to read.
|
|
| Back to top |
|
 |
Pseudo Xero I post too much
Reputation: 0
Joined: 16 Feb 2007 Posts: 2607
|
Posted: Tue Mar 11, 2008 11:28 pm Post subject: |
|
|
| 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 |
|
 |
dephreeze Cheater
Reputation: 0
Joined: 06 Oct 2006 Posts: 33
|
Posted: Wed Mar 12, 2008 4:59 am Post subject: |
|
|
| 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 |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Wed Mar 12, 2008 2:22 pm Post subject: |
|
|
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 |
|
 |
|