PathCchAddBackslashEx function (pathcch.h)
Adds a backslash to the end of a string to create the correct syntax for a path. If the source path already has a trailing backslash, no backslash will be added.
This function differs from PathCchAddBackslash in that it can return a pointer to the new end of the string and report the number of unused characters remaining in the buffer.
This function differs from PathAddBackslash in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.
Syntax
WINPATHCCHAPI HRESULT PathCchAddBackslashEx(
[in, out] PWSTR pszPath,
[in] size_t cchPath,
[out, optional] PWSTR *ppszEnd,
[out, optional] size_t *pcchRemaining
);
Parameters
[in, out] pszPath
A pointer to the path string. When this function returns successfully, the buffer contains the string with the appended backslash. This value should not be NULL.
[in] cchPath
The size of the buffer pointed to by pszPath, in characters.
[out, optional] ppszEnd
A value that, when this function returns successfully, receives the address of a pointer to the terminating null character at the end of the string.
[out, optional] pcchRemaining
A pointer to a value that, when this function returns successfully, is set to the number of unused characters in the destination buffer, including the terminating null character.
Return value
This function returns S_OK if the function was successful, S_FALSE if the path string already ends in a backslash, or an error code otherwise.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 8 [desktop apps | UWP apps] |
Minimum supported server | Windows Server 2012 [desktop apps | UWP apps] |
Target Platform | Windows |
Header | pathcch.h |
Library | Pathcch.lib |