Doesn't that method leave you open to false positives?
Originally Posted by CommonTater
I mean if you read in to EOF, and the strings are:
Which enter the buffer passed to fread like this:
Then when you try to search for the last img (1242), by doing:
char *location = strstr(buffer, "IMG_1242")
I mean I suppose you can always yank the string out up until the new line and then strcmp it with strlen to verify it that it's not larger...but I've seen substring methods yield false positives when one string happens to be a substring of another string (the requested string) within a given buffer.
if (location == buffer) // true
Personally if I was going to cache it like that I'd use fread to capture it all, then use the string tokenizer to split it at new lines and toss them in a double pointer. While it's more computational at the beginning, I feel it will pay off.
Though that was kind of a segway. While it's not *necessary* anymore than anything else is, I believe it would help greatly to tell him what his next steps should be. Though I definitely hear where you're coming from in terms of information overload.