[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

lseek64 og hvad er _GNU_SOURCE for noget?



Hej

Jeg har kun kunnet få lseek64() til at virke ved at bruge:
  gcc -D_GNU_SOURCE foo.c

Hvorfor det? Burde det ikke bare virke? Eller hvordan skal jeg ellers
håndtere en fil der er større end 2^31-1 bytes?

Her er min kode:

#include <stdio.h>
#include <fcntl.h>
#include <sys/types.h>
#include <unistd.h>
int main(int argc, char **argv) {
        int fd;
        off64_t ot = 0LL;

        if (argc > 1)
                if ((fd = open64(argv[1], O_RDWR)) > 0) {
                        printf("File open: %s\n", argv[1]);
                        ot = lseek64(fd, 0LL, SEEK_END);
                        printf("FilePos: %llu\n", ot);
                        close(fd);
                }

        return 0;
}

/hans
-- 
Hamletsgade 4 - 201, DK-2200 København N, Phone: +45 3582 9079
Schou Industries ApS      http://schou.dk/    CVR: 26 13 44 39
--------------------------------------------------------------
[about too many Linux distros]
Yes, choice is confusing, but it is better than no choice.
					-- Linus Torvalds


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *