#include // for EOVERFLOW, errno #include // for LONG_MAX #include // for ftello, FILE, ftell #include // for off_t long ftell(FILE *stream) { off_t pos; if ((pos = ftello(stream)) > LONG_MAX) { errno = EOVERFLOW; return -1; } return pos; }