Sagar said:
Is there any exception related to disk space ?
If not how else can we check the availability of the disk space in a
c++ program. I know ostream helps a bit. When we try to open a file
when there's no disk space ostream::rdstate() returns badbit.
IIRC, that's a platform specific thing that you'll want to look into the
platform documentation for. I'm not aware of any standard C++ way of
finding how much space is free (apart from the ostream being writable
and it... not being writable or, as you pointed out, returning an error).
For example, the Microsoft Windows PlatformSDK offers:
BOOL GetDiskFreeSpace(
LPCTSTR lpRootPathName,
LPDWORD lpSectorsPerCluster,
LPDWORD lpBytesPerSector,
LPDWORD lpNumberOfFreeClusters,
LPDWORD lpTotalNumberOfClusters
);
(include windows.h)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/getdiskfreespace.asp
--
Peter MacMillan
e-mail/msn: (e-mail address removed)
icq: 1-874-927
GCS/IT/L d-(-)>-pu s()
-) a- C+++(++++)>$ UL>$ P++ L+ E-(-) W++(+++)>$
N o w++>$ O !M- V PS PE Y+ t++ 5 X R* tv- b++(+) DI D+(++)>$ G e++ h r--
y(--)