-
Reading file
I need to scan an entire text file and I would like to know which is the best between copying the whole thing into memory and loading it part by part.
The file is not, or at least I don't think it could be, a large file, it is some sort of simple script for some simple tasks... (actually, it does not have a real goal except to make me discover a little more about programming)
Thanks to all who will answer this.
-
File IO is slow but if the file is not large compared to the read size, it should not be a problem.
I prefer to grenerally
find the file size,
alloc a buffer,
open,
read entire file,
close file,
process data,
free mem.
-
For windows, lookup the functions
CreateFile()
ReadFile()
I believe those are the functions
-
novacain >
Thanks, I think I can do it that way.
neandrake >
I already know the functions. ^^ Just posted the question here because maybe I could get some platform specific stuffs but, don't seem to. Thanks anyway.
-
try file mapping
CreateFileMapping
MapViewOfFile