blob: d26ba071242a04ccb5b8b83161c00df473f84b6c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
#include <errno.h> // for EOVERFLOW, errno
#include <limits.h> // for LONG_MAX
#include <stdio.h> // for ftello, FILE, ftell
#include <sys/types.h> // for off_t
long ftell(FILE *stream)
{
off_t pos;
if ((pos = ftello(stream)) > LONG_MAX) {
errno = EOVERFLOW;
return -1;
}
return pos;
}
|