error: ‘FILE’ has no member named ‘__fileL’

Viewed 215

I have a version of a program that used to compile to a *.o file, but now it does not, and gives a compiler error. I have tried to compile my code with gcc compiler on Linux, and the compile fails.

I see compiler error:

dspter.c:209:18: error: ‘FILE’ has no member named ‘__fileL’
   lseek ((int)Ofd->__fileL, 1-sizeof(PDAY_REC99), SEEK_END);

dspter.c:220:13: error: ‘FILE’ has no member named ‘__fileL’
   lseek (Ofd->__fileL, 1-sizeof(PDAY_REC99), SEEK_END);
Read99rec ()
{
    char    bf[20];

    if (curnt.ltype == LOAD_PDAY)
        {
        lseek ((int)Ofd->__fileL, 1-sizeof(PDAY_REC99), SEEK_END);
        fgets (Irec, sizeof(Irec), Ofd);
        memset (bf, NULL, sizeof (bf));
        memcpy (bf, Irec+2, 4);
        count01 += atoi(bf);
        memset (bf, NULL, sizeof (bf));
        memcpy (bf, Irec+6, 6);
        recs += atoi(bf);
        memset (bf, NULL, sizeof (bf));
        memcpy (bf, Irec+12, 16);
        ctrl_tot1 += atof(bf);
        lseek (Ofd->__fileL, 1-sizeof(PDAY_REC99), SEEK_END);
        }
1 Answers

The FILE structure is intended to be an opaque type. You shouldn't be accessing its members.

You should instead use the fileno function which will give you the underlying file descriptor associated with a FILE object.

However, in this case you don't want to do that either. Rather than using lseek, use fseek which performs the same operation but accepts a FILE * instead of a file descriptor number.

Related