www.delorie.com/djgpp/doc/libc-2.01/libc_282.html   search  
Go to the first, previous, next, last section, table of contents.


fnsplit

Syntax

#include <dir.h>

int fnsplit (const char *path, char *drive, char *dir, 
		char *name, char *ext);

Description

This function decomposes a path into its components. It is smart enough to know that . and .. are directories. 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.

Return Value

A flag that indicates which components were found:

DRIVE
The drive letter was found.
DIRECTORY
A directory or subdirectories was found.
FILENAME
A filename was found.
EXTENSION
An extension was found.
WILDCARDS
The path included * or ?.

Example

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.

  prev next   webmaster     delorie software   privacy  
  Copyright © 1997     Updated Apr 1997