inifile

How to read config file entries from an INI file

I can't use the Get*Profile functions because I'm using an older version of the windows CE platform SDK which doesn't have those. It doesn't have to be too general. [section] name = some string I just need to open the file, check for the existence of "section", and the the value associated with "name". Standard C++ preferred. ...

Reading/writing INI file in C#

Is there any class in .Net framework that can read/write standard ini files: [Section] <keyname>=<value> ... Delphi have TIniFile component and I am looking if there is anything similar for C#. ...

Universal approach for storing INI-type settings and/or DB files on various Windows machines

OK, true confession first: Maybe it's just me, but sometimes "best practices for program settings" on Windows machines feels like it's changed more than Microsoft's data access strategies. I'm still running XP, and somewhere along the way just kind "glazed over" about where MS wanted me to store all my app's data, etc. I controlled all...

How to initialise a C program using file, environment and/or command line?

In C, how to configure the initial settings for some program, using key-value pairs, with any or all of: a plain text configuration file, environment variables, and options on the command line. Also, how to decide which method's values overide those from either of the other two. Then if values have been changed, to optionally update the ...

How do I write Routing Chains for a Subdomain in Zend Framework in a routing INI file?

Hi, I am trying to create a subdomain using the Zend Router, and then for each section under a subdomain, such as subdomain.site.com/section/ I am creating another route and then trying to chain it to the subdomain route. but I don't know how. I have read all the documentation I could find and all the forums, but it leads me to figure i...

where to put initialization files in windows

I am looking for an acceptable starting point for placing applications settings in a Windows machine. I have more than one application. for personal reasons, I wouldn't like to use the registry: I prefer plain text initialization files (.ini). I also don't feel like holding the files in the same directory as the executables, the ideal...

Problem with kernel32.dll - GetPrivateProfileSectionNamesA

Hi, I have a problem reading IniFiles with different encodings. If I read a Unicode file, GetPrivateProfileSectionNamesA seems to stumble over the fist line. ASCII or ANSI works fine. I wrote a little program to illustrate my problem. First the output, then the program. I do not realy care about UTF7 and UTF32, but what I don't get is th...

Delphi ini file vista/xp/win7 Question

Update: I've added the following code: function TSettingsForm.AppDataPath: string; //CSIDL_APPDATA Individual user Data //CSIDL_COMMON_APPDATA Common to Computer Data // works so long as people have at least IE 4. (and Win95 or better) var r: Bool; path: array[0..Max_Path] of Char; begin r := ShGetSpecialFolderPath(0, pa...

Variables in ini files php

Hey I have this kinda structure in my ini file I want to be able parse a variable inside a variable value site.url = "www.example.com" site.url.images = site.url "/images" However, site.url is not parsed inside the site.url.images. I am using zend config ini to parse my ini files. Is there a solution beside adding this feature mysel...

How to retrieve value from etc/sysconfig in Python

Hi All, I have a config file FOO in /etc/sysconfig/. This Linux file is very similar to INI-File, but without a section declaration. In order to retrieve a value from this file, I used to write a shell script like: source /etc/sysconfig/FOO echo $MY_VALUE Now I want to do the same thing in python. I tried to use ConfigParser, but Co...

open database with initfile

how to open a database local or remote with IniFile. something like the below. vBanco : String; IniFileName : TIniFile; begin IniFileName := TIniFile.Create(ExtractFilePath(ParamStr(0))+FileName); Try if FileExists (remote+'db\ado.mdb') then begin vBanco := Trim(IniFileName.ReadString('a...

Read all the contents in ini file into dictionary with Python

Normally, I code as follows for getting a particular item in a variable as follows try: config = ConfigParser.ConfigParser() config.read(self.iniPathName) except ConfigParser.MissingSectionHeaderError, e: raise WrongIniFormatError(`e`) try: self.makeDB = config.get("DB","makeDB") except ConfigParser.NoOptionError: s...

Edit ini file option values with ConfigParser (Python)

Anyone know how'd I'd go about editing ini file values preferably using ConfigParser? (Or even a place to start from would be great!) I've got lots of comments throughout my config file so I'd like to keep them by just editing the values, not taking the values and playing around with multiple files. Structure of my config file: [name1]...

How do I perform a simple modification of an .ini file in perl?

I need change a value in a ini file like this val2 is the one being changed Before [section1] var1=val1 var2=val2 var3=va3 After: [section1] var1=val1 var2=value var3=va3 ...

C# read registry key, compare it to ini config file, if match return result under config section, do somethig else..

Hello, I got below problem and with my entry level of C# please help on how to get this be done? Scenario: 1. My registry keys: __DatabaseConnection |____config1 value: username1 value: password1 |____config2 value: username2 value:password2 My ini file: [configz] Database=MSSQL DatabaseName= ABC Host=localh...

GetPrivateProfileString - c++ class - return string - memory pre calculation

Hi - In GetPrivateProfileString, lpReturnedString returns the string value present in the key of a particular section of an ini file. My question is that how will i know exactly, how much memory has to be allocated, rather than just allocation a large chunk prior to calling this function. DWORD WINAPI GetPrivateProfileString( __in ...

Could there be encoding-related problems when storing unicode strings in ini files?

There are already questions regarding unicode and ini files, but many of them are rather domain-specific. So I am not sure if the answer can be applied to the general case. Motivation: I want to use ini files for storing simple data like some numbers and some strings. The strings are provided by users (input via GUI). The software could...