Fixed ftell for streams which are opened for reading and writing.

svn path=/trunk/; revision=3038
This commit is contained in:
Hartmut Birr 2002-06-10 21:23:34 +00:00
parent f0cb69cade
commit 9ac5422074

View file

@ -22,15 +22,15 @@ long ftell(FILE *f)
if (f->_cnt < 0)
f->_cnt = 0;
else if (f->_flag&_IOREAD)
{
adjust = - f->_cnt;
}
else if (f->_flag&(_IOWRT))
{
if (f->_base && (f->_flag&_IONBF)==0)
adjust = f->_ptr - f->_base;
}
else if (f->_flag&_IOREAD)
{
adjust = - f->_cnt;
}
else
return -1;