Click to See Complete Forum and Search --> : Space in Pendrive


Vjy
March 4th, 2007, 10:45 PM
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

Marc G
March 5th, 2007, 02:56 AM
GetDiskFreeSpace or GetDiskFreeSpaceEx.

Vjy
March 6th, 2007, 04:32 AM
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

AlbertGM
March 6th, 2007, 04:52 AM
Do you know the drive? If so, you can use: GetDiskFreeSpaceEx (http://msdn2.microsoft.com/en-us/library/aa364937.aspx)

Albert.

ovidiucucu
March 6th, 2007, 06:03 AM
[ Merged threads ]

Dear Vijay,
Please do not cross-post your questions in multiple forums.
Thank you!

ovidiucucu
March 6th, 2007, 06:05 AM
Just a little additional question.
How did you get the handle without knowing the path (or drive letter)?

Vjy
March 6th, 2007, 11:35 PM
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

Krishnaa
March 7th, 2007, 12:26 AM
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. (http://msdn2.microsoft.com/en-us/aa364939.aspx)