Input/Output help

I am at a point that I have no idea what to do. See my code below. The program will not open my mail.dat file that I am supposed to use to get the output of just the email address's on it that outputs to another file "address.dat" I think my code is right but I get nothing, any advice, thanks

// This programs outputs email address's that have the "@" symbol in them

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

int main()

ifstream inData;
string tempString;
ofstream outData;

// Open Data Files"mail.dat");"adresses.dat");
// Press enter to get the output to an external file
cout << "Please press enter for email address's" << endl;

// Test if file is there
if (!inData)
cout << "If mail.dat can not be found program will close" << endl;
return 1;


inData >> tempString;
if(tempString.find('@') != string::npos);

// Output Results
outData << "Email addresses:" << endl;

// Close Files

return 0;
if you do this:"mail.dat");

you're trying to open that file from the current path. So you need to know where the current path is. Usually somwhere near the .exe (if it's windows)
Topic archived. No new replies allowed.