File Handling problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: File Handling problem

  1. #1
    Join Date
    Jul 2002
    Location
    presently in SouthKorea
    Posts
    116

    Question File Handling problem

    Hi,

    I have written ftp client using VB.
    In this i used Get, Put and Seek statements for the local file handling when uploading and downloading. But these statements are not supporting the files larger than 2G.
    I decided to use CreateFile, ReadFile and WriteFile apis. But in case of these api how to seek the file pointer to the perticular location in the file ?

    Please help me

    Regards
    Praveenp

  2. #2
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,209

    Post

    SetFilePointer , SetFilePointerEx APIs move the file pointer of an open file.

  3. #3
    Join Date
    Jul 2002
    Location
    presently in SouthKorea
    Posts
    116
    but will the setfileptr move the file positon more than 2GB ? because api has the long parameters...

    i want to seek the file more than 2GB. is it ok with setfileptr?

    thanking you

    Praveenp

  4. #4
    Join Date
    Apr 2002
    Location
    Egypt
    Posts
    2,209
    ok..
    long (4 bytes=32bits) can not store more than 2GB number..
    but note that SetFilePointer :
    declaration :
    Code:
    DWORD SetFilePointer(
      HANDLE hFile,                // handle to file
      LONG lDistanceToMove,        // bytes to move pointer
      PLONG lpDistanceToMoveHigh,  // bytes to move pointer
      DWORD dwMoveMethod           // starting point
    );
    as you see it takes the second argument as the 32 Low-order 32 bits (unsigned) and the third argument is a Pointer to the high-order 32 of the 64-bit (the total is 64 bits=8bytes which can store much more than 2GB)...
    So you can exceed 2GB by using this function
    See MSDN for details

    hope this can help

  5. #5
    Join Date
    Jul 2002
    Location
    presently in SouthKorea
    Posts
    116
    Ya, I got it . Thanks for the INformation.

    I converted the 64 bit value into two 32-bit values and passed to the setfilepointer.

    It works fine.

    Thanks again.

    Praveen

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center