Ok, I need to read all the lines from a file and run a custom search in each line.Fine.
int main(int argc, char* argv[]){ char* pattern = argv[1]; string line; ifstream myFile(argv[2]); if (myFile.is_open()) { while (!myFile.eof()) { getline(myFile,line); if (search(pattern, line) == true) { cout << "yep"; } } myFile.close(); }}
bool search(char pattern[], char text[]);
9/21/2006 8:58:03 PM
you need to tokenize the stringor just include the string class and use the find() functionhttp://www.linuxselfhelp.com/HOWTO/C++Programming-HOWTO-7.html[Edited on September 21, 2006 at 9:10 PM. Reason : is parse and tokenize the same thing?]
9/21/2006 9:05:44 PM
convert string to char?
9/21/2006 9:09:27 PM
geezit's no wonder we never holla'd at bitches
9/21/2006 9:23:48 PM
const_cast<char*>(line.c_str()))and there are no compiler errors and thanks for bringing that up
9/21/2006 9:27:24 PM
why are you not using perl?
9/22/2006 1:21:07 AM