4 * Christian Groessler, 2000-08-07
5 * Ullrich von Bassewitz, 2004-05-13
17 /*****************************************************************************/
19 /*****************************************************************************/
23 long __fastcall__ ftell (register FILE* f)
27 /* Is the file open? */
28 if ((f->f_flags & _FOPEN) == 0) {
29 _seterrno (EINVAL); /* File not open */
33 /* Call the low level function */
34 pos = lseek (f->f_fd, 0L, SEEK_CUR);
36 /* If we didn't have an error, correct the return value in case we have
37 * a pushed back character.
39 if (pos > 0 && (f->f_flags & _FPUSHBACK)) {
43 /* -1 for error, comes from lseek() */