bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: read() and ftell()


From: Wolfram Gloger
Subject: Re: read() and ftell()
Date: Tue, 17 Sep 2002 10:01:32 +0200 (MDT)

Hi,

> In the program below, when I try to read the file with read() and get
> the byte offset with ftell(), ftell always return 1024. When I
> replace read() with fread(), ftell returns the correct values.
> 
> Is it really a bug? Or is it the expected behavior of ftell?

What ftell() returns in this case is unspecified, you can't mix stdio
and POSIX calls to the same file and expect it to give consistent
results always.  If you use read(), use lseek() to obtain the current
offset.

Regards,
Wolfram.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]