Click to See Complete Forum and Search --> : Determining File System


Anand Goel
September 9th, 1999, 12:48 AM
Is there any way in VC++ to determine the file system of the operating system at the runtime.
I mean any function which returns whether the file system is NTFS or FAT32 .

Peter A. Tolan
September 9th, 1999, 01:40 AM
Anand;

You can call a function called GetVolumeInformation(). Below is a code snippit;

char volname[32] ; // volume name to be returned
long ser_num; // unique serial number of drive.
long maxfilelen; // maximum length of filename supported.
long fs_flags; // particular flags related to file system.
char fs_type[32]; // name of file system on this drive.
BOOL retval;

retval GetVolumeInformation ( "c:\\", volname, sizeof ( volname ), &ser_num, &maxfilelen, &fs_flags, fs_type, sizeof ( fs_type ) ) ;

The return value in fs_type returns "FAT", "FAT32", "NTFS", etc.

To find out what the boot drive was, take a look at the environment variables. In Windows 95, my setting is

winbootdir=c:\win95

Hope this helps.



-Peter.

Anand Goel
September 9th, 1999, 03:40 AM
Thanx Peter it was a useful suggestion.