| www.delorie.com/djgpp/doc/libc-2.01/libc_337.html | search |
#include <mntent.h> struct mntent *getmntent(FILE *filep);
This function returns information about the various drives that are
available to your program. Beginning with drive A:, information
is retrieved for successive drives with successive calls to
getmntent. Note that drives A: and B: will only be
returned if there is an MS-DOS formatted disk in the drive; empty drives
are skipped. For systems with a single floppy drive, it is returned as
if it were mounted on A:/ or B:/, depending on how it was last referenced
(and if there is a disk in the drive).
For each drive scanned, a pointer to a static structure of the following type is returned:
struct mntent
{
char * mnt_fsname; /* The name of this file system */
char * mnt_dir; /* The root directory of this file system */
char * mnt_type; /* Filesystem type */
char * mnt_opts; /* Options, see below */
int mnt_freq; /* -1 */
int mnt_passno; /* -1 */
long mnt_time; /* -1 */
};
DJGPP implementation returns the following in the first 4 fields of
struct mntent:
mnt_fsname
mnt_dir
mnt_type
"fd" for floppy disks "hd" for hard disks "dblsp" for disks compressed with DoubleSpace "stac" for disks compressed with Stacker "jam" for disks compressed with Jam "cdrom" for CD-ROM drives "ram" for RAM disks "subst" for SUBSTed directories "join" for JOINed disks "net" for networked drives
mnt_opts
stat on mnt_fsname,
you will get the numeric equivalent of XX in st_dev field of
struct stat. E.g., for drive C: you will get "rw,dev=02". Note
that SUBSTed and JOINed drives get the drive numbers as if SUBST and JOIN
were NOT in effect.
This function returns a pointer to an struct mntent, or
NULL if there are no more drives to report on.
struct mntent *m;
FILE *f;
f = setmntent("/etc/mnttab", "r");
while ((m = getmntent(f)))
printf("Drive %s, name %s\n", m->mnt_dir, m->mnt_fsname);
endmntent(f);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |