Unfortunately your method is not so full proof. You see... when you open a file, it gets spit out into a buffer that you can then pull from. If you were to read from that buffer until you get to a @ sign, then everything before that would be discarded. Your best bet in doing this would be to open the file, read in a single word and store it into a string, use the std::string's find() function to look for a @ sign. If you find it, then check to make sure it ends with a URL extention. If it does, it's an email.
Code:
ifstream inFile("emailsandsuch.txt");
string currWord;
vector<string> emails;
while(inFile >> currWord)
if (currWord.find('@', 0) != string::npos && currWord.find('.', currWord.size() - 4) != string::npos)
emails.push_back(currWord);
inFile.close();
Or something similar. Lastly, never ask someone to write a program for you. If they want to give you code examples they will, but asking them to write it and send it to you is just asking for trouble.