CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2001
    Location
    Trutnov, Czech Republic
    Posts
    459

    Please help with assembling parameters for SetFilePointer

    Hi all,

    I'm trying to write my own function setFilePtr():

    Code:
    __int64 setFilePtr(HANDLE hFile, __int64 lDistanceToMove, DWORD dwMoveMethod)
    {
    	LONG highOrder = ...
    	LONG lowOrder = ...
    	lowOrder = SetFilePointer (hFile, lowOrder, &highOrder, dwMoveMethod);
    	if (lowOrder == 0xFFFFFFFF && GetLastError() != NO_ERROR)
    	{
    		highOrder = -1;
    	}
    	return highOrder;
    }
    As you may have guessed, it's just wrapper for SetFilePointer() made in order to be able to simply pass 64bit offset to it. But I don't know how to make low-order and high-order values from the given 64bit integer. I tried some byte shifting, but it didn't seem to work...

    Thank you
    The sun is the same in the relative way, but you're older
    Shorter of breath and one day closer to death


    - Roger Waters, 1973

  2. #2
    GCDEF is offline Elite Member Power Poster
    Join Date
    Nov 2003
    Location
    Florida
    Posts
    12,635

    Re: Please help with assembling parameters for SetFilePointer

    I'd assume you could just adapt the LOWORD and HIWORD macros

    #define LOWORD(l) ((WORD)(l))
    #define HIWORD(l) ((WORD)(((DWORD)(l) >> 16) & 0xFFFF))

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured