home *** CD-ROM | disk | FTP | other *** search
- #include <stdio.h>
- #include <errno.h>
- #include <unistd.h>
-
- extern void __chkabort(void);
-
- long ftell(FILE *stream)
- {
- long pos;
- __chkabort();
- if(stream->flags&64) /* Error on stream */
- { errno=EPERM;
- return EOF; }
- pos=lseek(stream->file,0,SEEK_CUR);
- if(stream->flags&4)
- pos-=stream->incount+(stream->tmpp!=NULL?stream->tmpinc:0);
- else if(stream->flags&8)
- pos+=stream->p-stream->buffer;
- return pos;
- }
-