construct a full pathname
#include <stdlib.h> void _makepath( char *path, const char *node, const char *dir, const char *fname, const char *ext );
The _makepath() function constructs a full pathname from the components consisting of a
The full pathname (for example, //2/home/fred/myfile.dat) is placed in the buffer pointed to by the argument path.
The maximum size required for each buffer is specified by the manifest constants _MAX_PATH, _MAX_NODE, _MAX_DIR, _MAX_FNAME, and _MAX_EXT, which are defined in <stdlib.h>.
The arguments to this function are as follows:
#include <stdio.h> #include <stdlib.h> void main() { char full_path[ _MAX_PATH ]; char node[ _MAX_NODE ]; char dir[ _MAX_DIR ]; char fname[ _MAX_FNAME ]; char ext[ _MAX_EXT ]; _makepath(full_path,"//0","/home/fred/h","stdio","h"); printf( "Full path is: %s\n\n", full_path ); _splitpath( full_path, node, dir, fname, ext ); printf( "Components after _splitpath\n" ); printf( "node: %s\n", node ); printf( "dir: %s\n", dir ); printf( "fname: %s\n", fname ); printf( "ext: %s\n", ext ); }
produces the output:
Full path is: //0/home/fred/h/stdio.h Components after _splitpath node: //0 dir: /home/fred/h/ fname: stdio ext: .h
WATCOM
Safety: | |
---|---|
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |