LabWindows/CVI

Content Type
Programming Language
Current manual

MakePathname

int MakePathname (char directoryName[], char fileName[], char pathname[]);

Purpose

Creates a pathname from a directory name or path and a filename. The subroutine ensures that a backslash separates the directory name or path and the filename.

Example Code

char dirname[MAX_PATHNAME_LEN];
char pathname[MAX_PATHNAME_LEN];
GetProjectDir (dirname); // where dirname has the following format: c:\myproject
MakePathname (dirname, "FILE.DAT", pathname); // where pathname has the following format: c:\myproject\myfile.dat

Note    MAX_PATHNAME_LEN is only reliable for ANSI single byte strings. For UTF-8 strings, call the IsUTF8PathLengthValid function to confirm that the file path is within the operating system character limit.

Parameters

Input
Name Type Description
directoryName char [] The directory name or path to which to append the filename.
fileName char [] Base filename and extension to append to the directory name or path.
Output
Name Type Description
pathname char [] The buffer in which the resulting pathname is returned.

The buffer must be at least MAX_PATHNAME_LEN bytes long.

If the resulting pathname is greater than that size, an empty string is returned in this buffer.

Return Value

Name Type Description
result int The result of the call.

Code Description
0 Success.
-1 Invalid parameter(s).
-2 Resulting pathname longer than 260 chars.

Additional Information

Library: Utility Library

Include file: utility.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Example

Refer to userint\custctrl\hyperlinkctrl\simple.cws for an example of using the MakePathname function.

Was this information helpful?

Log in to get a better experience