Click here to Skip to main content
Licence 
First Posted 16 Feb 2006
Views 18,060
Bookmarked 14 times

INI-File Controls, with pure API

By | 16 Feb 2006 | Article
Control the ini file very detail ( Session, Key, Key Value)

Introduction

hi, This description is Ini file control, Sharing code with others is a great way to not only help others, but also to become a better programmer. With many thousands of people downloading your code you will not only get a lot of positive feedback, but also bug fixes, free testing, and more often than not, suggestions on how to make the code even better. It also encourages others to share their code, which in turn gives you access to an even larger base of free source code.

So Sorry !!

[Modified: -explain]

I made CXIniFiles class, this class control(, Key and section , key value, add, delete, modify) INI-file. and inform(total number of section, number of key etc) ini-file.

CXIniFiles Class like this:

class CXIniFiles 
{
private:

 BOOL IsDataChanged;  // Handle of Current IniFile
 CString IniPath;          // Ini File  full path
  

 struct XSection  //Struct of  Inifile
 {
  CString SectionName;
  CArray<CString ,CString > Keys;
  CArray<CString ,CString > Values;
 };

 

 CArray<XSection,XSection> Sections;

 CString LegalString(CString path);
 int AddSection(CString sectionname);
 int AddSection(CStringArray mKeys,CStringArray mValues,CString sectionname);
 void SetPath(CString path);

public:

 //Construction & destruction

CXIniFiles();
 virtual ~CXIniFiles();

 BOOL Open(CString path);
 void Reset();
 void Close();
 void DoNotWrite();
 BOOL Write();

 int GetSectionIndex(CString sectionname);
 int GetSection(CStringArray &mKeys,CStringArray &mValues,CString sectionname);
 int GetSetionsSize(){return Sections.GetSize();}
 int GetKeyIndex(int sectionIndex,CString keyname);
 int GetKeysSize(CString sectionname);

 CString GetSection(int sectionIndex);
 CString GetKeyName(int sectionIndex, int keyIndex);
 CString GetKeyValue(CString sctionname,CString keyname);

 int DeleteSection(CString strsectionname);
 int AddKey(CString sectionname,CString keyname,CString value);
 int DeleteKey(CString sectionname,CString delkey);
 
 BOOL IsSection(CString sectionname);
 BOOL IsKey(CString sectionname ,  CString keyname);

 int SetKeyValue(CString sectionname,CString keyname,CString value); 
 int SetSectionValue(CString oldname,CString newname);
};

Very Simple Constructure!!!

Set and Get , and Is , ADD, DELETE real control method

Have a Nice Day and a Beautiful Life!!!

Do U Have a any Question, Send Mail plz.

 

 

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

handsomeme

Web Developer

United States United States

Member

Yeah, I'm programmer of the mediasolution in SEOUL, Korea. KKK
 
Bye

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionAnd what's a any question? PinmemberNitron3:12 20 Feb '06  
GeneralI couldn't help but notice... PinmemberNitron3:10 20 Feb '06  
GeneralWhere's the article Pinmemberjuggler0:42 17 Feb '06  
I don't mean to be rude - but this site is made valuable by the articles & tutorials and devalued by random code postings such as this.
 
You need to write an article to explain what you are doing, why and how, and in what way it is different from or improves upon what has gone before.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web01 | 2.5.120528.1 | Last Updated 16 Feb 2006
Article Copyright 2006 by handsomeme
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid