John Gordon
7/18/2011 9:36:00 PM
In <4e24a281$0$1929$bbae4d71@news.suddenlink.net> "Bill Cunningham" <nospam@nspam.invalid> writes:
> I want to take a 700MB file and skip evey 200MB, so I thought of this.
You mean you want to copy the 700MB file to another file, omitting
200MB chunks?
> long * space=malloc(sizeof(long)*500000);
There's no need to allocate that much space for a simple copy operation.
You can copy, say, 8K or 16K at a time without allocating a huge buffer.
> That would be good for code wouldn't it? Now how to tell where I am in the
> file. I have two choices. ftell() and fseek() or use f*pos() functions.
> Would anyone have any suggestions?
The f*pos() functions handle files which are too large for ftell/fseek,
and they also have special code to handle multibyte stream content.
If you don't care about those two concerns, then either functions will
work.
(By the way, I got this information by doing a Google search on the
phrase "what is the difference between ftell and fgetpos?")
--
John Gordon A is for Amy, who fell down the stairs
gordon@panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"