#include <dir.h> int fnsplit (const char *path, char *drive, char *dir, char *name, char *ext);
This function decomposes a path into its components. It is smart
enough to know that .
and ..
are directories, and that
file names with a leading dot, like `.emacs', are not all extensions.
The drive, dir, name and ext arguments should
all be passed, but some or even all of them might be NULL
pointers.
Those of them which are non-NULL
should point to buffers which have
enough room for the strings they would hold. The constants MAXDRIVE
,
MAXDIR
, MAXFILE
and MAXEXT
, defined on dir.h, define
the maximum length of these buffers.
See section fnmerge.
A flag that indicates which components were found:
DRIVE
DIRECTORY
FILENAME
EXTENSION
WILDCARDS
*
or ?
.
not ANSI, not POSIX
char d[MAXDRIVE], p[MAXDIR], f[MAXFILE], e[MAXEXT]; int which = fnsplit("d:/djgpp/bin/gcc.exe", d, p, f, e); d = "d:" p = "/djgpp/bin/" f = "gcc" e = ".exe"
Go to the first, previous, next, last section, table of contents.