Page 1 of 1
Thru which C++ API can I calculate disk space?
Posted: Fri Oct 10, 2003 3:32 pm
by Gh
Hi,
I want to calculate disk free and used space before saving a file on it. thru which c++ api can i achieve this.
I need urgent help. Any one please help me.
Regards,
Gh
Re:Thru which C++ API can I calculate disk space?
Posted: Fri Oct 10, 2003 5:52 pm
by nullify
It sounds like you're asking for help at the wrong place. This forum is for OS development. (ie., generally not programming for an existing system)
If your question is about OS development, then you'll either have to port a C++ API capable of doing this to your system, or write your own. Both require some underlying support (low-level hard drive interaction and a file system) to accomplish.
Re:Thru which C++ API can I calculate disk space?
Posted: Sat Oct 11, 2003 12:32 am
by Gh
No this is the write place to ask

I am implementing file system now a days and in that i want to use C++ API I searched on the net but didn't find any. That's why I post the message on that forum so that if every one have ever used such an API plz refer me that API.
Re:Thru which C++ API can I calculate disk space?
Posted: Sat Oct 11, 2003 2:14 am
by Solar
Gh wrote:
I am implementing file system now a days and in that i want to use C++ API I searched on the net but didn't find any.
Repeat rule #3 of OS programming: Unless you implemented the "standard" includes yourself (or ported some standard library to your OS), there are no standard includes.
That being said, neither the C nor the C++ standard library provide any means of calculating free disk space, because this is
OS dependent.
Re:Thru which C++ API can I calculate disk space?
Posted: Sat Oct 11, 2003 1:15 pm
by Ozguxxx
Well I think your (referring to Gh) problem is more basic one. I think searching for how API is serviced by OPERATING SYSTEM is more meaningful to you before interfacing with fs driver, which in later stage will be written by you. Most c API is not coded in BIOS. Well, some of it might be but fs API is dependent on OPERATING SYSTEM, not bios...
Re:Thru which C++ API can I calculate disk space?
Posted: Sun Oct 12, 2003 3:13 pm
by Pype.Clicker
Gh wrote:
No this is the write place to ask

I am implementing file system now a days and in that i want to use C++ API I searched on the net but didn't find any. That's why I post the message on that forum so that if every one have ever used such an API plz refer me that API.
Depending on which OS you'll develop your filesystem for, the API will be different.
You're likely to use the "block device interface" if you're working for Linux, or something from the Windows Device Development Kit (internals unknown) , thus making "read block" and "write blocks". Knowing the available amount of free space basically will consist of reading the Master Boot Record (MBR) for your disk and try to locate unpartitionned / unused space.
Re:Thru which C++ API can I calculate disk space?
Posted: Sun Oct 12, 2003 4:08 pm
by Tim
Gh wrote:I want to calculate disk free and used space before saving a file on it. thru which c++ api can i achieve this.
The C++ language doesn't know about "disks" and "space". Any method of determining the free space on a system which might support disks is operating system dependent. As you're writing your own OS, you will need to create your own function from scratch.