Files larger than 2GB (Was Re: ftell/fseek vs. fsetpos/fgetpos)

Files larger than 2GB (Was Re: ftell/fseek vs. fsetpos/fgetpos)

Post by Alex Measd » Wed, 22 Jun 1994 01:28:07



This is not intended as a stupid question!  :)  Has anyone addressed
files larger than 2GB by byte using standard (UNIX) calls on a 32-bit
machine and, if so, how did you do it?  Or were you forced to use
non-standard calls that indexed into the files by block?
--
                                Alex Measday
                                Integral Systems, Inc.

 
 
 

1. fsetpos & fgetpos w/calloc

Hello,
Something is driving me up the wall today - I have a bit of C code that
converts VRML files to a simple surface file format readable by my
company's software.  I am using fgetpos and fsetpos to find the 'point'
and 'coordIndex' headers in the wrl file so that I can get the points
and coordinates of the facets.  Essentially, I first parse through the
wrl file and tally up the the number of entities.  Then I calloc my
fpos_t variables and rewind so that I can parse again to get the
locations of the 'point' and 'coordIndex' headers for each entity.  I
then use fsetpos to position myself to get the number of points and
facets for each entity.  I rewind again and use fsetpos to reposition
myself to read in the coordinates of the points and facets.  It crashes
the second time I use fsetpos for the points, but not the first.  To
make matters worse, it only crashes on my RH 5.2 machine.  It runs fine
on my RH 6.0 and higher machines.  I know 5.2 is ancient but some of our
customers still have it.  Any help would be greatly appreciated.

The important parts of the code are below:

#define POINT "point"
#define COORINDEX "coordIndex"

int main(int argc, char argv[]) {
   fpos_t *pos1, *pos2;
    int i, entity;
    char buf[1024], txt;
    .
    .
    .
   if((pos1=(fpos_t *)calloc(entity, sizeof(fpos_t)))==NULL) {
      printf("\n\tMemory Overflow!!\n");
      exit(1);
   }

   if((pos2=(fpos_t *)calloc(entity, sizeof(fpos_t)))==NULL) {
      printf("\n\tMemory Overflow!!\n");
      exit(1);
   }
    .
    .
    .
   /* get positions of points and indices for each entity */
   i=0;
   while(i<entity) {
      fgets(buf, 256, fp);
      sscanf(buf, "%s", &txt);
      if(!strcmp(&txt, POINT)) {
         fgetpos(fp, &pos1[i]);
      }
      if(!strcmp(&txt, COORINDEX)) {
         fgetpos(fp, &pos2[i]);
         i++;
      }
   }
    .
    .
    .
   for(i=0; i<entity; i++) {
         /* get points */
         fsetpos(fp, &pos1[i]);
    .
    .
    .

2. First Impressions from a SuSE PPC install

3. weird problem with (fseek/ftell/fwrite/putc)

4. Setup Dialup Multilink PPP in Ubuntu Linux

5. Writing files larger than 2GB from AIX to Solaris

6. XFree86 on Thinkpad 390

7. Is there a version of gzip that handles files larger than 2GB?

8. can't find boot.hlp

9. Files larger than 2Gb

10. help! taring files larger than 2GB!

11. large files (larger than 2GB)?

12. Problems taring up files larger than 2GB on Solaris 8

13. file larger than 2GB