www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/08/11/12:22:26

To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Bug in libc.a?
Date: Thu, 11 Aug 94 14:40:13 +0200
From: Marios Siormanolakis <sior AT i50s18 DOT ira DOT uka DOT de>

Hi,

I have a problem with fseek() in the new 1.12 release.
If I replace libc.a with the old library ( libc.a in 1.11m5 )
everything is ok.

test.c:

#include <stdio.h>

void main()
{
  FILE  *fp;
  int   c;
  
  fp = fopen("test.dat","rb");
  if (fp)
  {
    c = fgetc(fp);
    printf("Pos %ld\n", ftell(fp));
    fseek(fp, 1L, SEEK_CUR);
    c = fgetc(fp);
    printf("Pos %ld\n", ftell(fp));
  }
}


The output should be:

Pos 1
Pos 3

But the output is:

Pos 1
Pos x		x is the length of test.dat + 1L

The output is the same when I replace SEEK_CUR with SEEK_END.


Marios Siormanolakis

sior AT ira DOT uka DOT de

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019