Επεξεργασία

Κοινή χρήση μέσω


PathCchRemoveBackslash function (pathcch.h)

Removes the trailing backslash from the end of a path string.

This function differs from PathRemoveBackslash in that it accepts paths with "\", "\?" and "\?\UNC" prefixes.

Note  This function, or PathCchRemoveBackslashEx, should be used in place of PathRemoveBackslash to prevent the possibility of a buffer overrun.

Syntax

WINPATHCCHAPI HRESULT PathCchRemoveBackslash(
  [in, out] PWSTR  pszPath,
  [in]      size_t cchPath
);

Parameters

[in, out] pszPath

A pointer to the path string. When this function returns successfully, the string contains the path with any trailing backslash removed. If no trailing backslash was found, the string is unchanged.

[in] cchPath

The size of the buffer pointed to by pszPath, in characters.

Return value

This function returns S_OK if the function was successful, S_FALSE if the string was a root path or if no backslash was found, or an error code otherwise.

Remarks

This function will not remove the backslash from a root path string, such as "C:".

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