i'm using this code to scan a document for the <script and </script> tags, I'm trying to copy each occurance of javascript from a html file and past is into a seperate edit.
Code:
szJava = NULL;
szBuffer[len] = '\0';
if(szJava = strstr(szBuffer,"<script"))
{
szRemain = strstr(szBuffer,"</script>");
strcpy(szRemain, szBuffer);
*szRemain = '\0';
SetWindowText(hJavaSource,szJava);
}
while(szJava != NULL)
{
szJava = NULL;
if(szJava = strstr(szBuffer,"<script"))
{
szBuffer[strlen(szBuffer)] = '\0';
szRemain = strstr(szBuffer,"</script>");
strcpy(szRemain, szBuffer);
*szRemain = '\0';
AddWindowText(hJavaSource,szJava);
}
}
if i only use the first part of this, the section not in the while loop it works fine but only finds the first occurance of the script tag. but once i added the while loop in it, it crashes with an Access violation message. is there anything wrong with the code or a better way to do this?