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


Groups > comp.lang.c > #13148

Re: how can i find the size of a binary file

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: how can i find the size of a binary file
Date 2011-11-11 15:15 -0800
Organization None to speak of
Message-ID <lny5vm5jz6.fsf@nuthaus.mib.org> (permalink)
References <j9k4i8$tah$1@speranza.aioe.org> <j9k56q$v3$1@reader1.panix.com> <j9k5g8$ve5$1@speranza.aioe.org> <4EBD9FC7.7010307@verizon.net>

Show all headers | View raw


James Kuyper <jameskuyper@verizon.net> writes:
[...]
> An extended discussion started the last time someone asked something
> like this. A popular contention was that it's pointless to ask how big a
> file is, because at best, the answer you'll get is how big it was at
> some time in the past; it might be a different size now. That point of
> view has some validity, but it ignores two things:
>
> 1. You might be explicitly looking for the current value of a time
> dependent quantity, such as keeping track of how fast a file is growing.
>
> 2. You might have done something to make sure that the file shouldn't
> change in size. This is extremely common, in my experience. There's
> often only one unprivileged userid currently authorized to change a
> given file. If that userid is mine, it's reasonably safe to assume that
> if I'm not currently changing the file, it's size won't change.

Agreed.  But even so, your code should probably be robust enough that it
doesn't blow up in your face if the file size *has* changed.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

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


Thread

how can i find the size of a binary file mark <nospam@nospam.com> - 2011-11-11 21:37 +0000
  Re: how can i find the size of a binary file John Gordon <gordon@panix.com> - 2011-11-11 21:48 +0000
    Re: how can i find the size of a binary file mark <nospam@nospam.com> - 2011-11-11 21:53 +0000
      Re: how can i find the size of a binary file jacob navia <jacob@spamsink.net> - 2011-11-11 23:00 +0100
      Re: how can i find the size of a binary file James Kuyper <jameskuyper@verizon.net> - 2011-11-11 17:20 -0500
        Re: how can i find the size of a binary file Keith Thompson <kst-u@mib.org> - 2011-11-11 15:15 -0800
        Re: how can i find the size of a binary file Phil Carmody <thefatphil_demunged@yahoo.co.uk> - 2011-11-12 12:43 +0200
      Re: how can i find the size of a binary file Keith Thompson <kst-u@mib.org> - 2011-11-11 14:25 -0800
  Re: how can i find the size of a binary file jacob navia <jacob@spamsink.net> - 2011-11-11 22:59 +0100
    Re: how can i find the size of a binary file Barry Schwarz <schwarzb@dqel.com> - 2011-11-11 17:46 -0800
      Re: how can i find the size of a binary file "io_x" <a@b.c.invalid> - 2011-11-14 18:18 +0100
        Re: how can i find the size of a binary file Barry Schwarz <schwarzb@dqel.com> - 2011-11-14 20:55 -0800
  Re: how can i find the size of a binary file Keith Thompson <kst-u@mib.org> - 2011-11-11 14:03 -0800
    Re: how can i find the size of a binary file Barry Schwarz <schwarzb@dqel.com> - 2011-11-11 17:46 -0800
      Re: how can i find the size of a binary file Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-14 01:21 -0800
        Re: how can i find the size of a binary file Barry Schwarz <schwarzb@dqel.com> - 2011-11-14 20:55 -0800
          Re: how can i find the size of a binary file Nick Keighley <nick_keighley_nospam@hotmail.com> - 2011-11-15 00:41 -0800
            Re: how can i find the size of a binary file James Kuyper <jameskuyper@verizon.net> - 2011-11-15 06:53 -0500
    Re: how can i find the size of a binary file Vincenzo Mercuri <vincenzo.mercuri@yahoo.it> - 2011-11-13 02:23 +0100
    Re: how can i find the size of a binary file Nobody <nobody@nowhere.com> - 2011-11-13 02:47 +0000
      Re: how can i find the size of a binary file jacob navia <jacob@spamsink.net> - 2011-11-13 08:44 +0100
        Re: how can i find the size of a binary file Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-11-13 12:31 +0000
        Re: how can i find the size of a binary file Roberto Waltman <usenet@rwaltman.com> - 2011-11-13 10:31 -0500
        Re: how can i find the size of a binary file Nobody <nobody@nowhere.com> - 2011-11-19 07:37 +0000
          Re: how can i find the size of a binary file Kaz Kylheku <kaz@kylheku.com> - 2011-11-19 17:54 +0000
            Re: how can i find the size of a binary file Willem <willem@toad.stack.nl> - 2011-11-19 18:18 +0000
            Re: how can i find the size of a binary file Keith Thompson <kst-u@mib.org> - 2011-11-19 14:19 -0800
              Re: how can i find the size of a binary file Kaz Kylheku <kaz@kylheku.com> - 2011-11-20 01:14 +0000
                Re: how can i find the size of a binary file Keith Thompson <kst-u@mib.org> - 2011-11-19 21:41 -0800
                Re: how can i find the size of a binary file Kaz Kylheku <kaz@kylheku.com> - 2011-11-20 05:52 +0000
                Re: how can i find the size of a binary file Keith Thompson <kst-u@mib.org> - 2011-11-19 22:23 -0800
        Re: how can i find the size of a binary file David Thompson <dave.thompson2@verizon.net> - 2011-11-21 02:39 -0500
  Re: how can i find the size of a binary file blp@cs.stanford.edu (Ben Pfaff) - 2011-11-11 14:32 -0800
    Re: how can i find the size of a binary file Barry Schwarz <schwarzb@dqel.com> - 2011-11-11 17:46 -0800
  Re: how can i find the size of a binary file Ike Naar <ike@sverige.freeshell.org> - 2011-11-11 22:41 +0000
  Re: how can i find the size of a binary file "BartC" <bc@freeuk.com> - 2011-11-13 12:32 +0000
    Re: how can i find the size of a binary file "BartC" <bc@freeuk.com> - 2011-11-13 14:56 +0000

csiph-web