Just use the counter variable to keep track of the current line number. Every time you call getline, you ... read the line ... so just increment the variable after that.
unsigned int curLine = 0;
while(getline(fileInput, line)) {
curLine++;
if (line.find(search, 0) != string::npos) {
cout << "found: " << search << "line: " << curLine << endl;
}
}
Also...
while(!fileInput.eof())
it should be
while(getline(fileInput, line))
eof , , . std::getline (, ), bool, , , .
eof, , , , , bad, - ..