Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C Library Reference - <u>synopsis:</u> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <stdlib.h>
    void _makepath( char *path,
                    const char *drive,
                    const char *dir,
                    const char *fname,
                    const char *ext );
    void _wmakepath( wchar_t *path,
                      const wchar_t *drive,
                      const wchar_t *dir,
                      const wchar_t *fname,
                      const wchar_t *ext );

Description:
    The _makepath function constructs a full pathname from the components
    consisting of a drive letter, directory path, file name and file name
    extension.  The full pathname is placed in the buffer pointed to by the
    argument path.

    The _wmakepath function is a wide-character version of _makepath that
    operates with wide-character strings.

    The maximum size required for each buffer is specified by the manifest
    constants  _MAX_PATH,  _MAX_DRIVE,  _MAX_DIR,  _MAX_FNAME, and  _MAX_EXT
    which are defined in <stdlib.h>.

    drive
        The drive argument points to a buffer containing the drive letter
        (A, B, C, etc.) followed by an optional colon.  The _makepath
        function will automatically insert a colon in the full pathname if
        it is missing.  If drive is a NULL pointer or points to an empty
        string, no drive letter or colon will be placed in the full
        pathname.

    dir
        The dir argument points to a buffer containing just the pathname.
         Either forward slashes (/) or backslashes (\) may be used.  The
        trailing slash is optional.  The _makepath function will
        automatically insert a trailing slash in the full pathname if it is
        missing.  If dir is a NULL pointer or points to an empty string, no
        slash will be placed in the full pathname.

    fname
        The fname argument points to a buffer containing the base name of
        the file without any extension (suffix).

    ext
        The ext argument points to a buffer containing the filename
        extension or suffix.  A leading period (.) is optional.  The
        _makepath routine will automatically insert a period in the full
        pathname if it is missing.  If ext is a NULL pointer or points to an
        empty string, no period will be placed in the full pathname.


Returns:
    The _makepath function returns no value.

Example:
    #include <stdio.h>
    #include <stdlib.h>

    void main()
      {
        char full_path[ _MAX_PATH ];
        char drive[ _MAX_DRIVE ];
        char dir[ _MAX_DIR ];
        char fname[ _MAX_FNAME ];
        char ext[ _MAX_EXT ];

        _makepath(full_path,"c","watcomc\\h\\","stdio","h");
        printf( "Full path is: %s\n\n", full_path );
        _splitpath( full_path, drive, dir, fname, ext );
        printf( "Components after _splitpath\n" );
        printf( "drive: %s\n", drive );
        printf( "dir:   %s\n", dir );
        printf( "fname: %s\n", fname );
        printf( "ext:   %s\n", ext );
      }

    produces the following:

    Full path is: c:watcomc\h\stdio.h

    Components after _splitpath
    drive: c:
    dir:   watcomc\h\
    fname: stdio
    ext:   .h


    Note the use of two adjacent backslash characters (\) within
    character-string constants to signify a single backslash.

Classification:
    WATCOM

Systems:
     _makepath - All, Netware

    _wmakepath - All

See Also:
    _fullpath, _splitpath

See Also:

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson