#include <iostream>
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
int main(){
fstream First("firstt.txt");
fstream File("file.txt");
string firsttime;
string blah1 = "enable";
string blah2 = "disable";
getline(First, firsttime);
if(firsttime!="not"){
First << "not";
cout << "first time settings (to be changed at file.txt)" << endl << "allow every one enter? enter disable(for no) and enable(for yes)" << endl;
string allow;
int end=0;
while(end!=1){
cin >> allow;
if(allow==blah1){
File << "allow? \n";
File << "enable";
end = 1;
return 0;
}else if(allow==blah2){
File << "allow? \n";
File << "disable";
end = 1;
return 0;
}else{
cout << "sorry what? please enter again" << endl;
}
}
} else{
string canIS;
for(int i =1; i<=2;i++){
getline(File, canIS, '\n');
}
if(canIS=="enable"){
cout<<"hey you hit the second line ";
cout << canIS << endl;
} else{
cout << "sorry the admin do not allow to you\n";
}
}
system("pause");
}
thats my code its a basic "settings" program and look on the top of it you will see
the fstream "First" and it suppose to write into it "not" (in the first IF)
and it dosent.... any ideas why? thanks anyway