Category : C Source Code
Archive   : EMXLIB8C.ZIP
Filename : FTELL.C
#include
#include
#include
/* Bug: incorrect result with text mode */
/* Bug: does not work with rw files(?) */
long ftell (FILE *stream)
{
long pos;
pos = lseek (stream->handle, 0L, SEEK_CUR);
if (pos < 0)
return (-1L);
if (stream->flags & _IOWRT)
{
if (bbuf (stream))
return (pos + (stream->ptr - stream->buffer));
else
return (pos);
}
else
return (pos - stream->rcount); /* ungetc! */
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/