File: ftell.c

package info (click to toggle)
klibc 2.0.1-3.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,248 kB
  • sloc: ansic: 47,887; asm: 2,394; perl: 758; makefile: 193; sh: 183
file content (12 lines) | stat: -rw-r--r-- 218 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
#include "stdioint.h"

off_t ftell(FILE *file)
{
	struct _IO_file_pvt *f = stdio_pvt(file);
	off_t pos = lseek(f->pub._IO_fileno, 0, SEEK_CUR);

	if (pos >= 0)
		pos += (int)f->obytes - (int)f->ibytes;

	return pos;
}