All pastes #757430 Raw Edit

Mine

public cpp v1 · immutable
·published 2007-11-01 10:27 UTC
rendered paste body
std::string loadConfiguration(std::string const& fileName, std::string *content_indices, std::string *content_values) {	// Read configurations.	std::ifstream file(fileName.c_str());	std::string line;	std::string name;	std::string value;	std::string inSection;	//std::string content_indices[255];	//std::string content_values[255];	int posEqual;	int i;	while ( std::getline(file, line) ) {		if ( !line.length() ) continue;		if ( line[0] == '#' ) continue;		if ( line[0] == ';' ) continue;		if ( line[0] == '[' ) {			inSection = trim(line.substr(1, line.find(']')-1));			continue;		}		posEqual = line.find('=');		name = trim(line.substr(0, posEqual));		value = trim(line.substr(posEqual+1));		content_indices[i] = inSection+"/"+name;		content_values[i++] = value;	}}int main() {	std::string indices[255];	std::string values[255];	loadConfiguration("config.ini", indices, values);	std::cout << indices;	return 0;	}