PathRenameExtensionA 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 PathRenameExtensionA(
  LPSTR  pszPath,
  LPCSTR pszExt
);

Parameters

pszPath

Type: LPTSTR

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

pszExt

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]
Target Platform Windows
Header shlwapi.h
Library Shlwapi.lib
DLL Shlwapi.dll (version 4.71 or later)