Comparing String to Filecontents?
I'm very new to C/C++, and I'm currently using the C-Styled strings. I'm trying to compare it to the contents of a file, just so I understand how to do it in the future. What kind of a command would I use to compare?
I know the code is VERY bad, but basically what I'm trying to do is compare char user to the contents of files.txt which I was trying to store in char user2.
using namespace std;
cout<< "Enter your desired username: ";
cin.getline( user, , '\n' );
ofstream a_file ( "files.txt" );
ifstream b_file ( "files.txt" );
if ( strcmp ( user, user2 ) == 0 )
cout<< "File appending successful!\n";
cout<< "Internal Error\n";
Thanks ahead of time, sorry about the stupid question I'm very new.