www.delorie.com/djgpp/bugs/show.cgi   search  
Bug 000065

When Created: 03/05/1996 12:07:30
Against DJGPP version: 2.00
By whom: javier@upisun1.uab.es
Abstract: ftell does not work with text files
File pru.c:

#include <stdio.h>
#include <stdlib.h>

main()
{
    FILE *fp;
    char a[100];

    fp=fopen("pru.c","r");
    fgets(a,100,fp);
    printf("%d\n",ftell(fp));
}

This program prints -16205 and this is a wrong file position.

Note added: 03/07/1996 11:02:52
By whom: Broeker@axpmgr.physik.rwth-aachen.de
That's not really a bug: just read what you find in the
description of ftell()'s companion function fseek(), and
think about what that implies. You will see quite easily
that, for almost the same reason, fseek() *can't* work on
text files.

Maybe, that should be added to libc.inf's node about ftell()?

Solution added: 04/13/1999 09:00:33
By whom: eliz@is.elta.co.il
Upgrade to v2.01, where fseek and ftell work with text files as well.

Fixed in version on 04/13/1999 09:00:36
By whom: eliz@is.elta.co.il



  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2010   by DJ Delorie     Updated Jul 2010