fnmerge
raw OCR
Builds a path from component parts.
Defined in header <dir.h>
Syntax
#include <dir.h>
void fnmerge(char *path, const char *dnve, const char *dir,
const char *name, const char *exty,
Portability
| DOS | UNIX | Windows | ANSI C | C++ only |
|---|---|---|---|---|
| ■ | ■ |
Remarks
fnmerge makes a path name from its components. The new path name is
X:\DIR\SUBDIR\NAME.EXT where
drive=X:
| dir | =\DIR\SUBDIR\ |
name=NAME
| ext | =.EXT |
fnmerge assumes there is enough space in path for the constructed path
| name. The maximum constructed length is MAXPATH. | MAXPATH | is |
defined in dir.h.
fnmerge and fnsplit are invertible; if you split a given path with fnsplit, then merge the resultant components with fnmerge, you end up with path.
Return value
None.
See also
Example
#include <string.h>
#include <stdio.h>
iinclude <dir.h>
int main (void)
{
char s [MAXPATH];
char drive [MAXDRIVE];
char dir[MAXDIR];
char file[MAXFILE];
char ext[MAXEXT];
getcwd (s,MAXPATH); /* get current working directory */
strcat (s, "W"); /* append a trailing \ character */
fnsplit (s,drive,dir,file,ext /* split the string to separate elems */
strcpy (file,"DATA");
strcpy(ext, ".TXT");
fnmerge (s,drive,dir,file,ext); /* merge everything into one string */
puts(s); /* display resulting string */
return 0;
}
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Stable link: /3.1/dir.h/fnmerge/
· short form /3.1/fnmerge/