Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 1 Aug 2001 20:41:32 -0500
From:      Alfred Perlstein <bright@mu.org>
To:        Joseph Gleason <clash@tasam.com>
Cc:        freebsd-hackers@FreeBSD.ORG
Subject:   Re: Finding filesizes in C++ for files greater than 4gb
Message-ID:  <20010801204132.K26571@elvis.mu.org>
In-Reply-To: <00b201c11af3$4fef1c10$0a2d2d0a@battleship>; from clash@tasam.com on Wed, Aug 01, 2001 at 09:34:43PM -0400
References:  <00b201c11af3$4fef1c10$0a2d2d0a@battleship>

next in thread | previous in thread | raw e-mail | index | archive | help
* Joseph Gleason <clash@tasam.com> [010801 20:35] wrote:
> In FreeBSD, how can I determine the size of a file in C++ when the file is
> greater than 4gb?
> 
> Currently, I use stat() and use st_size.  That is limited to 4gb (32bit
> unsigned int)

No it's not:

     struct stat {
         dev_t     st_dev;               /* inode's device */
...
         off_t     st_size;              /* file size, in bytes */

off_t is 64 bits under FreeBSD.

A bunch of other unix systems have alternate system calls to get
64bit attributes for files.

-- 
-Alfred Perlstein [alfred@freebsd.org]
Ok, who wrote this damn function called '??'?
And why do my programs keep crashing in it?

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010801204132.K26571>