My goal is to read a file until a specific string is found and then output what was read into another file. I've been working on this for a few days nowand this is all I've been able to come up with:
I've hit a brick wall after I've located the specific string. Any help would be greatly appreciated.Code:#include <iostream> #include <fstream> #include <string> using namespace std; int main() { char fileRead[256]; char * buffitUP; int bufferlength; char needle[] = "</script>"; cout << "enter name of the html file to open and edit: "; cin.getline(fileRead, 256); ifstream oFile; oFile.open (fileRead); oFile.seekg (0, ios::end); bufferlength = oFile.tellg(); oFile.seekg (0, ios::beg); buffitUP = new char [bufferlength]; oFile.read (buffitUP, bufferlength); if (strstr (buffitUP, needle) != NULL) cout << "found it"; return 0; }



LinkBack URL
About LinkBacks
and this is all I've been able to come up with:



this is what I have so far: