Export (0) Print
Expand All

PathCchAddBackslash function

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 you are restricted to a final path of length MAX_PATH.

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

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

Syntax


HRESULT PathCchAddBackslash(
  _Inout_  PWSTR pszPath,
  _In_     size_t cchPath
);

Parameters

pszPath [in, out]

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.

cchPath [in]

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 path string already ends in a backslash, or an error code otherwise.

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Pathcch.h

Library

Pathcch.lib

See also

PathCchAddBackslashEx

 

 

Community Additions

ADD
Show:
© 2014 Microsoft