I wrote the function below to find a pattern in a text:
bool match(char* patt,char* text){
int textLoc=0, pattLoc=0, textStart=0;
while(textLoc < (int) strlen(text) && pattLoc < (int)strlen(patt)){
if( *(patt+pattLoc) == *(text+textLoc) ){
textLoc= textLoc+1;
pattLoc= pattLoc+1;
}
else{
textStart=textStart+1;
textLoc=textStart;
pattLoc=0;
}
}
if(pattLoc >= (int) strlen(patt))
return true;
else return false;
}
As it appears, the function takes two parameters of the type char*. I would like to use this function to find a pattern in a binary file, what you suggest to carry out this issue?
CreateFilemMapping.. etc.