help with fscanf
View Single Post
03-02-2009, 10:18 PM
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Originally Posted by
You'd need to fscanf every line so whether you use that or fgets you're still reading every single line (up until the one that matches). fscanf just parses a line according to the formatting string which you don't need to do; you just need to see if the line is the one you want. Unless I'm mistaken. There's no faster way to do what you want without going through the file line-by-line.
Well, all I know is that by using fscanf I can find all matching rows in a 45 MB file in 80 ms. I know because I've benchmarked it... I think that is reason to believe that fscanf does not load all that data into PHP but rather does it all in C++ or somehow in the file system.
The problem is I have to know what the entire line is in order to do that.
EDIT: By looking at the comments on
I found you can use regex. That could very well solve my problem.
Dingo Web Systems >
My Website >
View Public Profile
Send a private message to ETbyrne
Visit ETbyrne's homepage!
Find More Posts by ETbyrne