Export (0) Print
Expand All
0 out of 1 rated this helpful - Rate this topic

PathCchRemoveBackslashEx function

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

This function differs from PathCchRemoveBackslash 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 PathRemoveBackslash in that it accepts paths with "\\", "\\?\" and "\\?\UNC\" prefixes.

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

Syntax


HRESULT PathCchRemoveBackslashEx(
  _Inout_    PWSTR pszPath,
  _In_       size_t cchPath,
  _Out_opt_  PWSTR *ppszEnd,
  _Out_opt_  size_t *pcchRemaining
);

Parameters

pszPath [in, out]

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.

cchPath [in]

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

ppszEnd [out, optional]

A value that, when this function returns successfully, receives the address of a pointer to end of the new string. If the string is a root path such as "C:\", the pointer points to the backslash; otherwise the pointer points to the string's terminating null character.

pcchRemaining [out, optional]

A pointer to a value that, when this function returns successfully, receives the number of unused characters in the destination buffer, including the terminating null character. If the string is a root path such as "C:\", this count includes the backslash in that string.

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

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Pathcch.h

Library

Pathcch.lib

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.