jeudi 26 mars 2015

why strlen () replace a string?

I got a pgm from internet. But I am confused about a code about strlen () function . Is it strlen() replace a string ? I am beginner in this coding .help me .


simple code block below :



while(NULL != fgets(Buffer, 4095, Input))
{
char *Stop = NULL;
char *Start = Buffer;

while(1)
{

Stop = strstr(Start, Find);
if(NULL == Stop)
{
fwrite(Start, 1, strlen(Start), Output);
break;
}
printf("\n@found at Line <%d>",line);
fwrite(Start, 1, Stop - Start, Output);
fwrite(Replace, 1, strlen(Replace), Output);
Start = Stop + strlen(Find);
}
line++;
}


why start = stop + strlen(find) replace a string ?


Aucun commentaire:

Enregistrer un commentaire