Well folks, here's the deal: this script was working perfectly fine, peachy, whatever, but then I apparently did something to screw it up. Danged if I know what it was. *scratches head*
Anyways..
[old]Note: readcon is a private ofstream of config, and writecon is a private ifstream[/old]
[edit]Note: readcon is a private ifstream of config, and writecon is a private ofstream[/edit]
Code:
config::loadconf( void ) {
readcon.open("config.blh");
if (!readcon) {cout << "Drat."<<endl;}
readcon >> temp;
if(!strcmp(temp,"JEPD")) {
readcon >> ver;
} else {
readcon.close();
newConf();
}
//Other stuff here, but wasn't running anyways, so doesn't matter.
readcon.close();
return ver;
}
int main ( void ) { //t'was more to my main, as well, but this is the stuff related to my prob...
config c;
c.loadconf();
return 0;
}
Now... inside config.blh is simple, plain ascii text of
And, by the way, I didn't put that there, it was written with:
Code:
config::newConf( void ) {
writecon.open("config.blh",ios::trunc);
writecon << "JEPD\n1\n[DBP]\n[ENDDBP]";
writecon.close();
cout << "Created new config file.\n";
readcon.open("config.blh");
return 0;
}
So, what happens is that it keeps running newConf...(and outputting "Drat").
It never successfully opens the file to read from.
I assume it's some easy fix that I'm missing, but I can't tell you what it is. Hopefully one of you can, I'll be greatfull for the help.
If you need any additional info to help me with this, please ask, because I'm pretty screwed, right now.