Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

PathRenameExtension function

Replaces the extension of a file name with a new extension. If the file name does not contain an extension, the extension will be attached to the end of the string.

Note  Misuse of this function can lead to a buffer overrun. We recommend the use of the safer PathCchRenameExtension function in its place.

Syntax


BOOL PathRenameExtension(
  _Inout_ LPTSTR  pszPath,
  _In_    LPCTSTR pszExt
);

Parameters

pszPath [in, out]

Type: LPTSTR

Pointer to a null-terminated string of length MAX_PATH in which to replace the extension.

pszExt [in]

Type: LPCTSTR

Pointer to a character buffer that contains a '.' character followed by the new extension.

Return value

Type: BOOL

Returns nonzero if successful, or zero if the new path and extension would exceed MAX_PATH characters.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 4.71 or later)

Unicode and ANSI names

PathRenameExtensionW (Unicode) and PathRenameExtensionA (ANSI)

 

 

Community Additions

ADD
Show:
© 2015 Microsoft