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++ Language Reference - ftell http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
   ftell

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

   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>

   FILE *fp;
   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 Value
   ftell returns the current file position. A -1L is returned if an error
   occurred and errno is set.


See Also: fseek isatty

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