ftell()

S

Servé Lau

GiM said:
What will ftell() return,
if I'm at the end of file that has size > 4G ?

there's no telling if you're using a platform where long is 32 bits. (as you
probably are)
Better to use fgetpos instead.
 
W

Wendy E. McCaughrin

: :> What will ftell() return,
:> if I'm at the end of file that has size > 4G ?

: there's no telling if you're using a platform where long is 32 bits. (as you
: probably are)
: Better to use fgetpos instead.

Correct, the reason being that -- unlike ftell(), which only returns the
current file position or garbage -- fgetpos() returns -1 on failure, and
also sets `errno' to the cause of error (EINVAL).
 
T

those who know me have no need of my name

in comp.lang.c i read:
unlike ftell(), which only returns the
current file position or garbage -- fgetpos() returns -1 on failure, and
also sets `errno' to the cause of error (EINVAL).

the return values are zero on success and non-zero on failure, and in
neither case is it required that errno be set. on posix/sus systems errno
is required to be set, but the return value on failure is not required to
be -1, only non-zero.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Issue with textbox script? 0
fseek 17
ftell() arithmetic vs. text files read as binary 7
skipping bytes 10
A Question of Style 51
Dr Dobbs snippet 20
size of block device by ftell() 2
questions on ftell and fopen 25

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top