read in MYDATA (with a space) from cin and find MYDATA in the file, print the line if its there. The line is going to be MYDATA + string.

int main (){
fstream filename;
filename.open(av[1]);
string name;
getline (cin, name);
lookeyLookey (name, filename);
}
void lookeyLookey (string& name, ofstream& filename){
    //how to look for MYDATA in file I have no idea
    if (found)
         cout << name << STRING AFTER MYDATA;

   else 
        cout << name << ": not found";
}

you need to put getline() in a loop inside the function lookyLooky() so that it reads all the lines in the file. Then on each loop iteration use the std::string's find() method to search for the desired text.

while( getline(filename, line) )
{
    // check to see if this line contains the desired string
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.