CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8
  1. #1
    Join Date
    Feb 2007
    Posts
    11

    Space in Pendrive

    I am developing application related to pen drive in VC++.

    I want to know the available space in the pendrive before sending data to it..
    I should not deal with the drivers.
    Can any one give suggestions regarding the APIs to find it.

    Thanks in advance
    Vijay
    Last edited by Vjy; March 4th, 2007 at 11:46 PM. Reason: modification

  2. #2
    Join Date
    Nov 2003
    Location
    Belgium
    Posts
    8,150

    Re: Space in Pendrive

    GetDiskFreeSpace or GetDiskFreeSpaceEx.
    Marc Gregoire - NuonSoft (http://www.nuonsoft.com)
    My Blog
    Wallpaper Cycler 3.5.0.97

    Author of Professional C++, 4th Edition by Wiley/Wrox (includes C++17 features)
    ISBN: 978-1-119-42130-6
    [ http://www.facebook.com/professionalcpp ]

  3. #3
    Join Date
    Feb 2007
    Posts
    11

    Free space in Pendrive

    Hai.
    I am developing VC++ application for a pendrive.
    In this i want to know the available free space.
    I discussed with some frens, they said to use GetDriveFreeSpaceEx() , but in this the 1st parameter consists of pointer to the file path, but iam having the handle of the device, nothing else....
    How far will it work..

    Waiting for suggestions

    Thanks in advance
    Vijay

  4. #4
    Join Date
    Nov 2006
    Location
    Barcelona - Catalonia
    Posts
    364

    Re: Free space in Pendrive

    Do you know the drive? If so, you can use: GetDiskFreeSpaceEx

    Albert.
    Please, correct me. I'm just learning.... and sorry for my english :-)

  5. #5
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Space in Pendrive

    [ Merged threads ]

    Dear Vijay,
    Please do not cross-post your questions in multiple forums.
    Thank you!
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  6. #6
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Space in Pendrive

    Just a little additional question.
    How did you get the handle without knowing the path (or drive letter)?
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  7. #7
    Join Date
    Feb 2007
    Posts
    11

    Re: Space in Pendrive

    Thanks for your suggestions..
    I got the handle to the device using createfile() function.
    I didnot get the drive letter, i think the drive letter is with driver.
    But iam having only the handle and also i am able to get the device information like the device descriptors.....

    Now i want to transfer data to it..
    Could you give suggestions in this aspect.

    Thanks
    Vijay

  8. #8
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882

    Re: Space in Pendrive

    Pendrive is not different from other drives for accessing it, you should use standrd Windows File/Folder API's for pendrive to, treating it as normal drive. The only thing you need to know about pendrive is the drive letter, that you can do by looking at drive type given by GetDriveType.
    Regards,
    Ramkrishna Pawar

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