| Last change
 on this file since 341 was             2, checked in by Dmitry A. Kuminov, 16 years ago | 
        
          | 
Initially imported qt-all-opensource-src-4.5.1 from Trolltech.
 | 
        
          | File size:
            751 bytes | 
      
      
| Line |  | 
|---|
| 1 | /* Sample program for configure to test Large File support on target | 
|---|
| 2 | platforms. | 
|---|
| 3 | */ | 
|---|
| 4 |  | 
|---|
| 5 | #define _LARGEFILE_SOURCE | 
|---|
| 6 | #define _LARGE_FILES | 
|---|
| 7 | #define _FILE_OFFSET_BITS 64 | 
|---|
| 8 | #include <unistd.h> | 
|---|
| 9 | #include <sys/types.h> | 
|---|
| 10 | #include <sys/stat.h> | 
|---|
| 11 | #include <assert.h> | 
|---|
| 12 | #include <stdio.h> | 
|---|
| 13 |  | 
|---|
| 14 | int main( int, char **argv ) | 
|---|
| 15 | { | 
|---|
| 16 | // check that off_t can hold 2^63 - 1 and perform basic operations... | 
|---|
| 17 | #define OFF_T_64 (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) | 
|---|
| 18 | if (OFF_T_64 % 2147483647 != 1) | 
|---|
| 19 | return 1; | 
|---|
| 20 |  | 
|---|
| 21 | // stat breaks on SCO OpenServer | 
|---|
| 22 | struct stat buf; | 
|---|
| 23 | stat( argv[0], &buf ); | 
|---|
| 24 | if (!S_ISREG(buf.st_mode)) | 
|---|
| 25 | return 2; | 
|---|
| 26 |  | 
|---|
| 27 | FILE *file = fopen( argv[0], "r" ); | 
|---|
| 28 | off_t offset = ftello( file ); | 
|---|
| 29 | fseek( file, offset, SEEK_CUR ); | 
|---|
| 30 | fclose( file ); | 
|---|
| 31 | return 0; | 
|---|
| 32 | } | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.