home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 5.ddi / CLIBSRC2.ZIP / FNMERGE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  2.3 KB  |  67 lines

  1. /*-----------------------------------------------------------------------*
  2.  * filename - fnmerge.c
  3.  *
  4.  * function(s)
  5.  *        fnmerge - make new filename
  6.  *-----------------------------------------------------------------------*/
  7.  
  8. /*
  9.  *      C/C++ Run Time Library - Version 5.0
  10.  *
  11.  *      Copyright (c) 1987, 1992 by Borland International
  12.  *      All Rights Reserved.
  13.  *
  14.  */
  15.  
  16.  
  17. #include <stdlib.h>
  18.  
  19. /*---------------------------------------------------------------------*
  20.  
  21. Name            fnmerge - makes new file name
  22.  
  23. Usage           #include <dir.h>
  24.                 void fnmerge(char *path, const char * drive, const char * dir,
  25.                              const char * name, const char * ext);
  26.  
  27. Related
  28. functions usage int fnsplit(const char *path, char *drive, char *dir,
  29.                             char *name, char *ext);
  30.  
  31. Prototype in    dir.h
  32.  
  33. Description     fnmerge makes a file name from its components. The
  34.                 new file's full path name is
  35.  
  36.                         X:\DIR\SUBDIR\NAME.EXT
  37.  
  38.                 where
  39.  
  40.                         X is given by drive
  41.                         \DIR\SUBDIR\ is given by dir
  42.                         NAME.EXT is given by name and ext
  43.  
  44.                 If the drive, dir, name, or ext parameters are null or empty,
  45.                 they are not inserted in the path string.  Otherwise, if
  46.                 the drive doesn't end a colon, one is inserted in the path.
  47.                 If the dir doesn't end in a slash, one is inserted in the
  48.                 path.  If the ext doesn't start with a dot, one is inserted
  49.                 in the path.
  50.  
  51.                 The maximum sizes for the path string is given by the
  52.                 constant MAXPATH (defined in dir.h), which includes space
  53.                 for the null-terminator.
  54.  
  55.                 fnsplit and fnmerge are invertible; if you split a given path
  56.                 with fnsplit, then merge the resultant components with fnmerge,
  57.                 you end up with path.
  58.  
  59. Return value    None
  60.  
  61. *---------------------------------------------------------------------*/
  62. void _CType _FARFUNC fnmerge(register char *pathP, const char *driveP,
  63. const char *dirP, const char *nameP, const char *extP)
  64. {
  65.         _makepath(pathP,driveP,dirP,nameP,extP);
  66. }
  67.