On Fri, Mar 03, 2000 at 05:17:58PM -0800, Brian Wright wrote:
> Hi, all..
>
> Is there an equivalent to the tell() function from DOS/Windoze? I'm in the
> process of porting a program over and it does file i/o with open, close, lseek.
> These are using an int handle, and a file stream will not work for this
> application. There doesn't appear to be a tell() function though. The DOS
> function uses io.h, and it's called out as long tell(int handle). Nothing
> seems to be in the GNU docs for glibc listing a similar function.
If you look carefully at the man page for lseek() you'll see:
RETURN VALUES
Upon successful completion, lseek returns the resulting
offset location as measured in bytes from the beginning of
the file. Otherwise, a value of (off_t)-1 is returned and
errno is set to indicate the error.
So, knowing this, if you write code similar to this, you'll have
what I think you're asking for:
#include <sys/types.h>
#include <unistd.h>
long tell (int filedes)
{
return (long) lseek (filedes, 0L, SEEK_CUR);
}
Tell() must be some MS-specific/non-standard extension?
Fred
>
> Thanks,
> Brian
> _________________________________________________________________________
> Brian Wright Aturna Communications Inc.
> [EMAIL PROTECTED] Internet Services
> WWW http://www.aturna.net
> _________________________________________________________________________
>
>
> --
> To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
> as the Subject.
--
---- Fred Smith -- [EMAIL PROTECTED] ----------------------------
"For the word of God is living and active. Sharper than any double-edged
sword, it penetrates even to dividing soul and spirit, joints and marrow;
it judges the thoughts and attitudes of the heart."
---------------------------- Hebrews 4:12 (niv) ------------------------------
--
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.