stat() fails for large file (2GB)

Discussion in 'C Programming' started by Alona, Mar 14, 2008.

  1. Alona

    Alona Guest

    Hi All,

    stat fails on a 2GB file with errno=EOVERFLOW.
    Is there a way to run stat() on a large file?

    Thanks,
    Alona
    Alona, Mar 14, 2008
    #1
    1. Advertising

  2. Alona

    santosh Guest

    Alona wrote:

    > Hi All,
    >
    > stat fails on a 2GB file with errno=EOVERFLOW.
    > Is there a way to run stat() on a large file?


    Stat is not defined by ISO C, so you might want to ask in
    comp.unix.programmer.

    <OT>
    Use stat64. See your system's documentation for the C library or the
    online documentation for POSIX.
    </OT>
    santosh, Mar 14, 2008
    #2
    1. Advertising

  3. Alona

    Alona Guest

    On Mar 14, 3:58 pm, santosh <> wrote:
    > Alona wrote:
    > > Hi All,

    >
    > > stat fails on a 2GB file with errno=EOVERFLOW.
    > > Is there a way to run stat() on a large file?

    >
    > Stat is not defined by ISO C, so you might want to ask in
    > comp.unix.programmer.
    >
    > <OT>
    > Use stat64. See your system's documentation for the C library or the
    > online documentation for POSIX.
    > </OT>


    stat64() works, but S_ISREG returns that the file is not a regular
    file, while it is a regular text file.
    Alona, Mar 14, 2008
    #3
  4. Alona

    santosh Guest

    Alona wrote:

    > On Mar 14, 3:58 pm, santosh <> wrote:
    >> Alona wrote:
    >> > Hi All,

    >>
    >> > stat fails on a 2GB file with errno=EOVERFLOW.
    >> > Is there a way to run stat() on a large file?

    >>
    >> Stat is not defined by ISO C, so you might want to ask in
    >> comp.unix.programmer.
    >>
    >> <OT>
    >> Use stat64. See your system's documentation for the C library or the
    >> online documentation for POSIX.
    >> </OT>

    >
    > stat64() works, but S_ISREG returns that the file is not a regular
    > file, while it is a regular text file.


    You *really* should post this to a group that's specific to your
    environment like <news:comp.unix.programmer>.

    Also WRT my previous advice you should probably define _FILE_OFFSET_BITS
    to 64 and use stat in a transparent manner.
    santosh, Mar 14, 2008
    #4
  5. Alona

    CBFalconer Guest

    Alona wrote:
    >
    > stat fails on a 2GB file with errno=EOVERFLOW.
    > Is there a way to run stat() on a large file?


    STAT is a CP/M system program. The system doesn't handle 2GB files.

    --
    [mail]: Chuck F (cbfalconer at maineline dot net)
    [page]: <http://cbfalconer.home.att.net>
    Try the download section.



    --
    Posted via a free Usenet account from http://www.teranews.com
    CBFalconer, Mar 14, 2008
    #5
  6. Alona

    Ian Collins Guest

    CBFalconer wrote:
    > Alona wrote:
    >> stat fails on a 2GB file with errno=EOVERFLOW.
    >> Is there a way to run stat() on a large file?

    >
    > STAT is a CP/M system program. The system doesn't handle 2GB files.
    >

    Which is probably why the OP is using a system with a function named
    stat. In case you hadn't noticed, C is case sensitive.

    --
    Ian Collins.
    Ian Collins, Mar 15, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steven T. Hatton
    Replies:
    3
    Views:
    9,696
    Pete Becker
    Jun 2, 2005
  2. Patrick Useldinger

    os.stat('<filename>')[stat.ST_INO] on Windows

    Patrick Useldinger, Feb 27, 2005, in forum: Python
    Replies:
    6
    Views:
    1,159
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Mar 3, 2005
  3. Rolf Schroedter

    Accessing large >2GB file succeeds fails with open/read

    Rolf Schroedter, Feb 15, 2005, in forum: C Programming
    Replies:
    6
    Views:
    517
    Olof Lagerkvist
    Feb 16, 2005
  4. Magesh
    Replies:
    3
    Views:
    432
    Gordon Burditt
    Oct 5, 2007
  5. Rolf Krüger
    Replies:
    2
    Views:
    607
    Ian Collins
    Mar 12, 2008
Loading...

Share This Page