Original Post
Hey, I''m having trouble with writing to files. I''m trying to create a log system where you can keep important events down.
Well, String doesn''t work, that just takes 1 word. char doesn''t work same thing. this is my code so far.
int main()
{
string cmd1;
display.display1 = 0;
while(display.display1 == 0)
{
ifstream a_file("pass.txt");
char string1[50];
string pass;
a_file >> string1;
a_file.close();
cout << " -----------------------------" << endl;
cout << "| Welcome to the Demon Realms |" << endl;
cout << "| Please enter password.... |" << endl;
cout << " -----------------------------" << endl;
cout << "Demon Realms Studios>> ";
cin >> pass;
if(pass == string1)
{
display.display1=(display.display1 + 1);
cout << "Correct" << endl;
}
else
{
cout << "Incorrect" << endl;
}
}
cout << "Demon Realms Studios>>" << endl;
ofstream b_file("log.txt");
cout << ": ";
const int max = 50;
char event[max];
cin.getline(event, max);
b_file << event;
b_file.close();
return(0);
}
but all it does is come up and say press anykey to continue and doesn''t let me actually type anything. Any sugustions?