ini library in OSX

Joel via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Sep 9 21:31:18 PDT 2014


Here's a failed attempt of mine - after the line. I would usually 
have stuff like the following (right next):

Ini ini;
ini=new Ini( cfg );
ini["section"]["key"] = value;


-----------

import ini;

void main() {
	import std.conv;
	//load
	string data;
	int i;
	foreach(item; parseINI(File("test.ini"))) {
		data ~= item.to!string~"\n";
		writeln("[*", i++, ' ', text(item), "*]");
	}

	//save //#not working!
	data ~= "frog=jump"; // add more information
	data ~= "frog=jump";
	auto file = File("test.ini", "w");
	file.write(data);
	i = 0;
	foreach(item; parseINI(File("test.ini"))) {
		writeln("[+", i++, ' ', text(item), "+]");
	}
}


More information about the Digitalmars-d-learn mailing list