WatchGuard DNSWatch reduces malware infections by detecting and blocking malicious DNS requests, improving your ability to protect employees from phishing attacks. Learn more about our newest service included in Total Security Suite today!
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Finding a string in a file is easier if the file consists of fixed-size records. In that case, you can read a buffer at a time (each buffer will consist of n records) and search each record using strcmp(). If there are no fixed-size records than you'll have to deal with the possibility that the string may spawn across two buffers so you'll have to make sure that the buffers you read overlap by the length of the string.
In any case, if you are accessing the file in a purely sequential way, you can save some overhead by using OS commands directly instead of C run-time functions.