Re: How to get File System info
- From: "Bob Eager" <rde42@xxxxxxxxxxx>
- Date: 28 Jul 2005 22:06:56 GMT
On Thu, 28 Jul 2005 21:48:43 UTC, Peter Flass <Peter_Flass@xxxxxxxxx>
top posted:
> Bob Eager wrote:
> > On Wed, 27 Jul 2005 21:00:36 UTC, "Keith" <ktmos2NOSPAM@xxxxxxxxxxxx>
> > wrote:
> >>does anybody have a simple method of obtaining the file system type , i.e
> >>FAT, HPFS, CDFS, JFS ...
> >>in C.
> >>
> >>A code snippet would be very helpful.
> > I'll email it to you.
> Post would be nice. If it's too long, I'd appreciate an email also, if
> it isn't too much trouble. Thanks.
It's not as long as I thought...so here it is. The bit about strcmp and
constants at the end is just how I wanted it for a particular program,
and can be excised.
----------------------------------------------------------
/*
* Function to determine the type of file system on the drive specified
* in 'path'.
*
* Returns FS_CDFS, FS_CDWFS, FS_NFS, FS_FAT or FS_HPFS;
* any error causes the result to default to FS_FAT.
*
*/
static enum FS_T fstype(PUCHAR path)
{ UCHAR fsqbuf[FSQBUFSIZE];
PUCHAR p;
ULONG fsqbuflen = FSQBUFSIZE;
UCHAR drv[3];
if(path[1] != ':') { /* No drive in path - use default */
curdrv(drv);
} else {
drv[0] = path[0];
drv[1] = path[1];
drv[2] = '\0';
}
if(DosQueryFSAttach(
drv,
0,
FSAIL_QUERYNAME,
(PFSQBUFFER2) fsqbuf,
&fsqbuflen) != 0)
return(FS_FAT);
/* Set 'p' to point to the file system name */
p = fsqbuf + sizeof(USHORT); /* Point past device type */
p += (USHORT) *p + 3*sizeof(USHORT) + 1;
/* Point past drive name and FS name */
/* and FSDA length */
if(strcmp(p, "CDFS") == 0) return(FS_CDFS);
if(strcmp(p, "CDWFS") == 0) return(FS_CDWFS);
if(strcmp(p, "HPFS") == 0) return(FS_HPFS);
if(strcmp(p, "NFS") == 0) return(FS_NFS);
return(FS_FAT);
}
----------------------------------------------------------
.
- References:
- How to get File System info
- From: Keith
- Re: How to get File System info
- From: Bob Eager
- Re: How to get File System info
- From: Peter Flass
- How to get File System info
- Prev by Date: Re: wxWidgets
- Next by Date: Re: wxWidgets
- Previous by thread: Re: How to get File System info
- Next by thread: wxWidgets
- Index(es):
Relevant Pages
|
Loading