Programming |  C Programming |  _makepath

defined in stdlib.h

Syntax

Description

_makepath creates a single path name, composed of a drive letter, directory path, file name, and file name extension.

The path argument should point to an empty buffer large enough to hold the complete path name. The constant _MAX_PATH, defined in , specifies the maximum size allowed for path. The other arguments point to the following buffers containing the path name elements:

drive A letter (A, B, ...) corresponding to the desired drive and an optional following colon. _makepath inserts the colon automatically in the composite path name if it is missing. If drive is a null character or an empty string, no drive letter or colon appears in the composite path string .

dir The path of directories, not including the drive designator or the actual file name. The trailing slash is optional, and either slash (/) or backslash (\) or both can be used in a single dir argument. If a trailing slash or backslash is not specified, it is inserted automatically. If dir is a null character or an empty string, no slash is inserted in the composite path string.

fname The base file name without any extensions.

ext The actual file name extension, with or without a leading period. _ makepath inserts the period automatically if it does not appear in ext. If ext is a null character or an empty string, no period is inserted in the composite path string.

The size limits on the above four fields are those specified by the constants _MAX_DRIVE, _MAX_DIR, _MAX_FNAME, and _MAX_EXT, which are defined in . The composite path should be no larger than the _MAX_PATH constant also defined in ; otherwise, the operating system does not handle it correctly.

Note: No checking is done to see if the syntax of the file name is correct .

Returns

There is no return value.