i'm making my own game engine on sdl + opengl i also know that i can manage file for my setting and save game that way (i am on windows)

#include <windows.h>

void ini::setfile(std::string name)
	name += ".ini";
	std::string directory;
	char path[1024];
	GetModuleFileName(NULL, path, 1024);
	directory = path;
	size_t found;
	found = directory.find_last_of("\\");
	directory = directory.substr(0,found+1);
	file = directory + name;

void ini::write(char *section, char *key, char *value)
	char filebuf[file.length()];
	WritePrivateProfileStringA(section, key, value, filebuf);

But i can use my game on Linux except that i cant compile cause windows.h is only for windows and i try to use fstream to do the same as WritePrivateProfileStringA(section, key, value, file);
but don't know how to store multiple value in an ordered manner so user can easy edit them (for custom level or other) and i also already ported my encrypted version (so user can't cheat and edit their online save) but i'm not sure if there is a better way or other cause i never use fstream before event if it seam to work on windows i don't know for use on Linux

bool encodetofile(const std::string SIn, const std::string passwd, const string fileName)
	istringstream In;
	string encFileName = fileName + ".enc";
	ofstream encFile(encFileName.c_str());
	if (!encFile.is_open())return false;
	string result;
	string passwdCopy(passwd);
	int index = 0;


	//encrypted using a polyalphabetic cipher.
	char c = In.get(); //get first char
	while(!In.eof()) // as long as we have something to read
		encFile.put(c + passwdCopy[index]++);
		index %= passwdCopy.length();
		c = In.get(); // get an other char to start again
	return true;

also if you want to try my code don't use cin >> SIn;
cause space are not ok with it use cin.getline(SIn, 1024); and all will work space and all...

Sorry for my english... lol i'm french. Also never study C++ in my life so if i am doing something wrong please tell me.....

fstream us standard c++ class so it works the same on all operating systems that support them.

WritePrivateProfileString() does nothing more than rewrite the file with the new string in the form <tag name>=<value> . You can do this yourself with ofstream.

ofstream out("filename.ini");
out << "[MySectionName]\n"; // beginning of section
out << "LName=" << lname << "\n";
out << "FName=" << fname << "\n";
<etc. etc. for all fields

i was just hopping for a way that i don't need to rewrite all of it... but for now i will do it that way...