Checking if strings are equal
In java I know that you can never say "==" to check if two strings are equal but in C++ you can. Here's what I am having trouble with:
Code:
in.open(argv[i]);
if(in.is_open())
{
while(!in.eof())
{
getline(in,line);
cout << line << endl;
if(line=="\n")
cout << "found new line" << endl;
}
}
else cout << "CAN'T OPEN" << endl;
in.close();
I put new lines in the file by hitting enter, and it prints the new lines but never enters that if statement. Am I doing this wrong?
Thanks!