Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned char *str_find(const char *pFindIn, const char *pToFind)
- {
- unsigned char *found = NULL;
- int findInLen = strlen(pFindIn);
- int toFindLen = strlen(pToFind);
- int currLen = 0;
- for (; *pFindIn != '\0';)
- {
- if (*pFindIn == *pToFind) //1
- {
- unsigned char foundSame = 1;
- for (int i=0; i<toFindLen; i++) { //2
- if (*(pFindIn + i) == '\0' || *(pFindIn + i) != *(pToFind + i)) {
- foundSame = 0;
- break;
- }
- }
- if (foundSame) { //3
- found = (unsigned char*)pFindIn;
- }
- }
- pFindIn++; //4
- }
- return found;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement