delorie.com/djgpp/doc/libc/libc_336.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

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, 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.

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 ?.

Portability

ANSI/ISO C No
POSIX No

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"


  webmaster     delorie software   privacy  
  Copyright © 2004     Updated Apr 2004