Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Support Forum
Download Visual Studio Add-In

Terms of Use
Privacy Policy
setfilepointerex (kernel32)
 
.
Summary

C# Signature:

[DllImport("kernel32.dll")]
static extern bool SetFilePointerEx(IntPtr hFile, long liDistanceToMove,
   IntPtr lpNewFilePointer, uint dwMoveMethod);

C# Signature:

[DllImport("kernel32.dll")]
public static extern bool SetFilePointerEx(
     SafeFileHandle hFile, long liDistanceToMove,
     out long lpNewFilePointer, uint dwMoveMethod);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

The third argument (lpNewFilePointer) is of type LARGE_INTEGER, which has a size of 64 bits. For this reason use a UInt64 for this argument. (See sample below)

Sample Code:

UInt64 n = 0; //it is important to use UInt64, because the 3rd argument is of type PLARGE_INTEGER, where LARGE_INTEGER has a size of 64 bits.

IntPtr ptr = new IntPtr(&n);

SetFilePointerEx(handle, 0, ptr, FILE_CURRENT);//ptr contains current location of file pointer. handle is a pointer to an open file handle.

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

LARGE_INTEGER - http://msdn.microsoft.com/en-us/library/aa383713(VS.85).aspx

UInt64 - http://msdn.microsoft.com/en-us/library/system.uint64.aspx

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions