Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main (int argc, char *argv[])
- {
- FILE *infile;
- int pos;
- char bigline[1135035] = "";
- const char *needle1 = "puid=34561\">";
- const char *needle2 = "</a>";
- char *start, *end;
- int len;
- char outline[32];
- infile = fopen ("test.bin", "r");
- if (infile == NULL)
- {
- fprintf (stderr, "Couldn't open file\n");
- return 1;
- }
- fgets (bigline, sizeof(bigline), infile);
- start = bigline;
- while ( (start = strstr(start, needle1)) != NULL )
- {
- strcpy (outline, "");
- start += strlen(needle1);
- end = strstr (start, needle2);
- len = end - start;
- strncpy (outline, start, len);
- outline[len] = '\0';
- fprintf (stdout, "%s\n", outline);
- start += len;
- }
- fclose (infile);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement