[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]


tell

Returns the current offset for a file.

Compatibility:

This function is compatible with the following targets:

ANSI
BeOS
EMB/RTOS

Mac OS

Palm OS

Win32


Prototype:
#include <unix.h>
long tell(int fildes);
Parameters:

Parameters for this facility are:

fildes  
int  
The file descriptor  

Remarks:

This function returns the current offset for the file associated with the file descriptor fildes. The value is the number of bytes from the file's beginning.

Return:

If it is successful, tell() returns the offset. If it encounters an error, tell() returns -1L

See Also:

"ftell"

"lseek"

Example of read() usage.:
#include <stdio.h>
#include <unix.h>

int main(void)
{
	int fd;
	long int pos;

	fd = open("mytest", O_RDWR | O_CREAT | O_TRUNC);
	write(fd, "Hello world!\n", 13);
	write(fd, "How are you doing?\n", 19);

	pos = tell(fd);

	printf("You're at position %ld.", pos);

	close(fd);

	return 0;
}

Result
This program prints the following to standard output:
You're at position 32.


[ First ]  [ Previous ]  [ Next ]  [ Last ]  [ Manuals ]

Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.

Last updated: August 16, 2000