Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: "Ravishankar S" <ravishankar.s@xxxxxxxxxxxx>
- Date: Mon, 31 Dec 2007 12:21:08 +0530
"Scott.zhou" <rwxrxrx@xxxxxxxxx> wrote in message
news:fla6k1$j8h$1@xxxxxxxxxxxxxxxx
10 #define _FILE_OFFSET_BITS 64No automatic conversion to 64 bit type is done by compiler. So make it
11
12 int main(void) {
13 int fd;
14
15 if ((fd = open("file.hole", O_WRONLY | O_CREAT, 0664)) < 0) {
16 perror("open:");
17 exit(-1);
18 }
19
20 if (write(fd, "a", 1) != 1) {
21 perror("write:");
22 exit(-1);
23 }
24
25 if (lseek(fd, 4*1024*1024*1024, SEEK_SET) == -1) { // integer
overflow
explicit by making one of the constants as 64 bit type. This makes entire
expression 64 bit.
=> 4*1024*1024*1024LL // 64 Bit constant made by LL suffix.
.
- Follow-Ups:
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- From: James Kuyper
- Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Prev by Date: Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Next by Date: Re: Programming in standard c
- Previous by thread: Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Next by thread: Re: Cannot compile with _FILE_OFFSET_BITS = 64
- Index(es):
Relevant Pages
|