using fread with fscanf
i would like to know if it is possible to use fread(which can read files fast) to load a file into a char buffer or similar then use fscanf or anything else to extract the formatted data? cheers
|
YOu mean tu read a file with fread and then parse the array with sscanf? (fscanf wil read from the file, so, dont read twice ;) ). If thats the case, sure you can.... but I dont think that it will make any difference in performance. Besides, dont asume that your program will run slow when it reads from a file. Maybe your performance problems (if any) could be somewhere else.
Cheers! |
the problem im having is that to run fscanf over the whole file is taking a long time, memory access and writing is almost no time and i know it almost takes no time to read the whole file into a buffer. so i was thinking i could read the file into a buffer then parse that, but i dont know how!
|
oh, actually i think thats exactly what i wanted, thanks a lot
|
Hehe I hit the solution by the tangent :D
Cheers! |
All times are GMT -5. The time now is 05:44 PM. |