aboutsummaryrefslogtreecommitdiffstats
path: root/usr/klibc/stdio/ftell.c
blob: 4db13dd9064cb9e2f192ab739189d872c306a412 (plain)
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 = f->funcs.seek(f->cookie, 0, SEEK_CUR);

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

	return pos;
}