July 29th, 2002, 06:21 AM
The Gentle Art of File Data Extraction
I'm trying to find and extract data from a file with C, but I can't seem to find a good way to do so. I almost thought I had it there with strncmp() for a while, but that road only led to dissapointment.
Here's what I'm trying to do:
Given a file like this;
--start of fake.db--
--end of fake.db--
I want to be able to input a location, a phone number, or a name and return the entire line for my parsing.
Anyone have any ideas? Perhaps a new function to explore?
July 29th, 2002, 01:19 PM
Ever thought of exploring the strstr() function :)
August 6th, 2002, 08:25 AM
August 6th, 2002, 08:30 AM
if (strstr(searchstr, filestr) != null)
//this line contains the data
//this line does not contain the data
July 20th, 2003, 07:42 AM