Ok, I have the reading from the datafile line by line sorted, however I have a string that I want to search for in the datafile. This is what I had, however it doesnt work.
Appointments.open(DATAFILE);
if (Appointments.is_open())
{
// Read the file until it's finished, displaying lines as we go.
while (!Appointments.eof())
{
getline(Appointments, line); // getline reads a line at a time
if (found == string::npos)
{
cout << "You have the following appointment(s) today:" << endl;
cout << line << endl;
}
Appointments.close();
}
}
ifstream Appointments;
string line;
string date(charDate); .
size_t found;
found = line.find(date);
Appointments.open(DATAFILE);
if (Appointments.is_open())
{
// Read the file until it's finished, displaying lines as we go.
while (!Appointments.eof())
{
getline(Appointments, line); // getline reads a line at a time
if (found == string::npos)
{
cout << "You have the following appointment(s) today:" << endl;
cout << line << endl;
}
Appointments.close();
}
}
so...ummm, what are you comparing here?
if (found == string::npos)
edit, do you have the function and associated functions pasted here too?