Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #8458

Re: skipping bytes

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.glorb.com!solaris.cc.vt.edu!news.vt.edu!newsfeed-00.mathworks.com!panix!gordon
From John Gordon <gordon@panix.com>
Newsgroups comp.lang.c
Subject Re: skipping bytes
Date Mon, 18 Jul 2011 21:35:30 +0000 (UTC)
Organization PANIX Public Access Internet and UNIX, NYC
Lines 30
Message-ID <j028v2$8ne$1@reader1.panix.com> (permalink)
References <4e24a281$0$1929$bbae4d71@news.suddenlink.net>
NNTP-Posting-Host panix3.panix.com
X-Trace reader1.panix.com 1311024930 8942 166.84.1.3 (18 Jul 2011 21:35:30 GMT)
X-Complaints-To abuse@panix.com
NNTP-Posting-Date Mon, 18 Jul 2011 21:35:30 +0000 (UTC)
User-Agent nn/6.7.3
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:8458

Show key headers only | View raw


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"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

skipping bytes "Bill Cunningham" <nospam@nspam.invalid> - 2011-07-19 05:15 -0400
  Re: skipping bytes John Gordon <gordon@panix.com> - 2011-07-18 21:35 +0000
    Re: skipping bytes "Bill Cunningham" <nospam@nspam.invalid> - 2011-07-19 05:43 -0400
      Re: skipping bytes blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-19 17:27 +0000
        Re: skipping bytes Chad <cdalten@gmail.com> - 2011-07-19 12:09 -0700
          Re: skipping bytes blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-19 21:34 +0000
        Re: skipping bytes "Bill Cunningham" <nospam@nspam.invalid> - 2011-07-20 03:17 -0400
          Re: skipping bytes blmblm@myrealbox.com <blmblm.myrealbox@gmail.com> - 2011-07-19 21:35 +0000
            Re: skipping bytes "Bill Cunningham" <nospam@nspam.invalid> - 2011-07-20 07:01 -0400
            Re: skipping bytes "Bill Cunningham" <nospam@nspam.invalid> - 2011-07-22 11:25 -0400
  Re: skipping bytes Ian Collins <ian-news@hotmail.com> - 2011-07-19 09:42 +1200

csiph-web