I am trying to find a string within a substring using strstr. This only works with char arrays. I have an array of objects of which I am searching a particular property which is a string.
I am using C++
Code:
char *strPtr; int index = 0; bool located = false; do { for(index = 0; index <NUM_BOOKS; index ++) { strPtr = strstr(bookList[index].getTitle(), book);//str1, str2); if(strPtr == NULL) { cout << "No matching titles were found.\n"; } else { located = true; found.push_back(index); } } }while(index < NUM_BOOKS && !located);
Comment