Retrieving Data

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..
inputFile << password; Are you trying to write password in input file?
No, i'm trying to retrieve the password from the input file..
So you need to use extraction operator, not insertion.
inputFile >> password;
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..
Topic archived. No new replies allowed.