StrCpyNW function (shlwapi.h)

Copies a specified number of characters from the beginning of one string to another.

Note  Do not use this function or the StrNCpy macro. See Remarks for alternative functions.
 

Syntax

PWSTR StrCpyNW(
  [out] PWSTR  pszDst,
  [in]  PCWSTR pszSrc,
        int    cchMax
);

Parameters

[out] pszDst

Type: PTSTR

A pointer to a buffer that, when this function returns successfully, receives the copied string. This buffer must be of sufficient size to hold the copied characters. This string is not guaranteed to be null-terminated.

[in] pszSrc

Type: PCTSTR

A pointer to the null-terminated source string.

cchMax

Type: int

The number of characters to be copied, including the terminating null character.

Return value

Type: PTSTR

Returns a pointer to pszDst.

Remarks

Security Warning:  Using this function incorrectly can compromise the security of your application. The copied string is not guaranteed to be null-terminated. Consider using one of the following alternatives. StringCbCopy, StringCbCopyEx, StringCbCopyN, StringCbCopyNEx, StringCchCopy, StringCchCopyEx, StringCchCopyN, StringCchCopyNEx. You should review Security Considerations: Microsoft Windows Shell before continuing.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)