Go to the first, previous, next, last section, table of contents.


setmntent

Syntax

#include <mntent.h>

FILE *setmntent(char *filename, const char *mode);

Description

This function returns an open FILE* pointer which can be used by getmntent (see section getmntent). The arguments filename and mode are always ignored under MS-DOS, but for portability should be set, accordingly, to the name of the file which describes the mounted filesystems and the open mode of that file (like the mode argument to fopen, See section fopen). (There is no single standard for the name of the file that keeps the mounted filesystems, but it is usually, although not always, listed in the header <mntent.h>.)

Return Value

The FILE* pointer is returned. For MS-DOS, this FILE* is not a real pointer and may only be used by getmntent.

Portability

not ANSI, not POSIX

Example

#include <mntent.h>
#if defined(MNT_MNTTAB)
#define MNTTAB_FILE MNT_MNTTAB
#elif defined(MNTTABNAME)
#define MNTTAB_FILE MNTTABNAME
#else
#define MNTTAB_FILE "/etc/mnttab"
#endif

  FILE *mnt_fp = setmntent (MNTTAB_FILE, "r");


Go to the first, previous, next, last section, table of contents.