Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>ftell</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
ftell

Usage

   #include <stdio.h>
   long ftell(FILE *fp);

   ANSI

Description

   ftell returns the current position in the file associated with the stream
   fp. If the file is opened in text mode, the returned value may not
   accurately reflect the number of bytes actually read or written.

Example 

   #include <stdio.h>
   #include <stdlib.h>

   FILE *fp;

   int main()
   {
       long position;

       fp = fopen("file.dat","a");
       fprintf(fp,"Sample data string\n");
       position = ftell(fp);   /* get file position */
       printf("Position of file pointer: %ld\n",position);
       fclose(fp);
       return EXIT_SUCCESS;
   }

Return Value

   ftell returns the current file position. A -1L is returned if an error
   occurred and errno is set.

See Also

   fseek, isatty



See Also: fseek isatty

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson