Skip to main content
Email Password   helpLost your password?

Sample Image - aejw_ini_class.jpg

Introduction

This is a class for reading and adjusting INI files. The class utilizes the WritePrivateProfileString and GetPrivateProfileString API calls. Written mainly for legacy support, as a lot applications still use INI files and although there is XML support native to .NET (".config" files), I tend to find that for some circumstances INI files are straightforward and more practical to use.

Using the code

Functions / Methods

The following examples require the object / class to be declared.

aejw.cIni oIni = new aejw.cIni("C:\\INIFile.ini");

Read Value

//Read value from INI

string sRet = oIni.ReadValue("TheSection", "TheKey", "");

Write Value

//Write value to INI

oIni.WriteValue("TheSection", "TheKey", "TheValue");

Remove Value

//Remove value from INI

oIni.RemoveValue("TheSection", "TheKey");

Read Sections

//Read sections from INI

Array oSections = new Array[0];
oIni.ReadSections(ref oSections);

Read Values (Value names)

//Read values from INI

Array oValues = new Array[0];
oIni.ReadValues(ref oValues);

About the code

Below is a general breakdown of how the code works...

History

You must Sign In to use this message board.
 
 
Per page   
 FirstPrevNext
GeneralThanks for the Class Pin
Decad
1:34 18 Jul '08  
GeneralRe: Thanks for the Class Pin
aejw
15:53 20 Jul '08  
GeneralIf the value is Unicode,like simple chinese charset, there will be a bug Pin
lwlojj
5:17 17 Jul '08  
GeneralRe: If the value is Unicode,like simple chinese charset, there will be a bug Pin
aejw
15:52 20 Jul '08  
Questionhelp Pin
Member 3813771
4:13 11 Feb '08  
AnswerRe: help Pin
aejw
15:56 20 Jul '08  
QuestionHigh ASCII chars in value name Pin
z00z0
8:27 20 Mar '06  
AnswerRe: High ASCII chars in value name Pin
aejw
17:57 2 May '06  
GeneralRe: High ASCII chars in value name Pin
z00z0
10:43 4 May '06  
GeneralNaming convebtions Pin
Guido_d
1:15 10 Aug '05  
GeneralRe: Naming convebtions Pin
aejw
8:51 10 Aug '05  
GeneralUnicode Pin
Elder Benassi
22:16 3 Aug '05  
GeneralRe: Unicode Pin
Anonymous-aejw
1:49 6 Aug '05  
Generalerror in ReadSections Pin
yurij
11:08 2 Aug '05  
GeneralRe: error in ReadSections Pin
aejw
12:56 3 Aug '05  
GeneralNini?? Pin
RabidKangaroo
14:18 20 Apr '05  
GeneralRe: Nini?? Pin
Yinon Ehrlich
21:18 14 Jun '05  
GeneralNative version Pin
Guido_d
3:14 20 Apr '05  
GeneralRe: Native version Pin
aejw
9:28 20 Apr '05  
GeneralSymbols Pin
Speedhawk
7:59 12 Apr '05  
GeneralRe: Symbols Pin
aejw
17:32 14 Apr '05  
GeneralRe: Symbols Pin
Speedhawk
0:42 16 Apr '05  
GeneralcINI0015.cs Pin
zoranl
18:48 16 Mar '04  
GeneralRe: cINI0015.cs Pin
aejw
0:34 18 Mar '04  
GeneralRe: cINI0015.cs Pin
zoranl
18:58 18 Mar '04  


Last Updated 9 Aug 2005 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2009