Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_makepath() make path name from components</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _makepath()             Make Path Name from Components

 #include   <stdlib.h>

  void _makepath(path, drive, dir, fname, ext);
  char *path;       Full path name buffer
  char *drive;      Drive letter
  char *dir;        Directory path
  char *fname;      File name
  char *ext;        File extension

    _makepath() creates a full MS-DOS path name from the component
    arguments. The path argument should point to an empty buffer large
    enough to hold the complete path name.

    The manifest constant _MAX_PATH (defined in stdlib.h) specifies the
    maximum size path that MS-C can handle. The constants _MAX_DRIVE,
    _MAX_DIR, _MAX_FNAME, and _MAX_EXT are also available for specifying
    the maximum size of the component arguments.

    The component arguments must point to appropriate values before
    calling _makepath(). The following table describes permissible
    elements:

      Buffer    Description
      ------    -----------------------------------------------
       drive    Contains a letter (A, B, C, etc.) corresponding to the
                desired drive. A missing colon will be inserted by
                _makepath() automatically. If drive is a null character
                or empty string, no drive letter or colon will be
                inserted in path.

         dir    Contains path of directories, excluding drive and file
                name. Forward slashes (/) and backslashes (\) can be used
                interchangeably and intermixed in the same argument, but
                because of MS-C's syntax requirements, a backslash (if
                used) must be doubled. Missing trailing slashes will be
                inserted automatically. If dir is a null character or
                empty string, no slash will be inserted in path.

       fname    Contains the base file name without any extensions.

         ext    Contains the filename extension. If the leading period
                (.) is missing _makepath() will insert one automatically.
                If ext is a null character or empty string, no period
                will be inserted in path.

      Notes:    The size of the combined component arguments should be no
                larger than _MAX_PATH.

   Portability:     MS-DOS only

 -------------------------------- Example ---------------------------------

 This program builds a combined path name from components

           #include <stdlib.h>

           main()
           {
              char path_name[_MAX_PATH + 1];

              _makepath( path_name, "c", "\\msc\\include", "stdio", "h");
              printf("Combined path = %s\n", path_name);

           }


See Also: _splitpath()

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