Home > Windows API > Only rename file extension!

Only rename file extension!

Ever felt the need for renaming a file extension!

Use PathRenameExtension.

Does not verify the integrity of given path. Renames extension if there is one, else just appends given extension to given path. So if I give C:\\System32 as path then the output will be C:\\System32.doc.

TCHAR szPath[MAX_PATH] = _T( “C:/nibu.txt” );
PathRenameExtension( szPath, _T( “.doc” ));
wcout < < szPath;[/sourcecode] Output
C:/nibu.doc

Advertisements
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: