I have a file that I need to read and determine how many times a certain string appears. Is this possible? If so, how do I do it. The file is a plain text file in wordpad.
I would go along the path of opening it with CFile and reading the whole thing into a buffer. (you can get the file size with CFileStatus or CStatus (cant remember acutall name)) Read it into a buffer and use strstr on it.
char* ptr = strstr(buffer,search_string);
int counter = 0;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.