Jan 25, 2015 at 10:28am UTC
I need help as to how to read data from a file. Please help..
int main()
{
ifstream inputFile;
inputFile.open("/tmp/Passwords.txt");
int password;
inputFile << password;
return 0;
}
On my Mac it says that there is an error and I can't figure out what the error is. I used Xcode..
Jan 25, 2015 at 10:44am UTC
inputFile << password;
Are you trying to write password in input file?
Jan 25, 2015 at 11:20am UTC
No, i'm trying to retrieve the password from the input file..
Jan 25, 2015 at 11:23am UTC
So you need to use extraction operator, not insertion.
inputFile >> password;
Jan 27, 2015 at 3:00pm UTC
Oh yeah.Thanks MiiNiPaa. I didn't realise that seriously. I'll think twice or maybe thrice with my code without posting it then and there without thinking..