Current file position?

Is there a function that returns the current file position? Like cstdio's ftell(FILE*) function.

I'm opening the file with a HANDLE and CreateFile()
1
2
3
4
LONG GetFilePointer(HANDLE hFile)
{
   return SetFilePointer(hFile,0,0,FILE_CURRENT);
}

or if you are working with large files (>4GB)
1
2
3
4
5
6
7
8
9
10
11
long long GetFilePointer(HANDLE hFile)
{
   LARGE_INTEGER ret;

   LARGE_INTEGER pos;
   pos.QuadPart=0;

   SetFilePointerEx(hFile,pos,&ret,FILE_CURRENT);

   return ret.QuadPart;
}


SetFilePointer: http://msdn.microsoft.com/en-us/library/aa365541(VS.85).aspx
SetFilePointerEx: http://msdn.microsoft.com/en-us/library/aa365542(v=VS.85).aspx
Topic archived. No new replies allowed.