PathRemoveExtensionPathRemoveExtension*
*Contents  *Index  *Topic Contents
*Previous Topic: PathRemoveBlanks
*Next Topic: PathRemoveFileSpec

PathRemoveExtension


void PathRemoveExtension(
    LPTSTR pszPath
    );

Removes the file extension from a path, if there is one.

pszPath
Address of the path from which to remove the extension.

Example:

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{

    // Path to include file spec.
	char buffer_1[] = "C:\\TEST\\sample.txt"; 
	char *lpStr1;
	lpStr1 = buffer_1;

    // Print the path with the extension.
	cout << "The path with extension is          : " << lpStr1 << endl;
 
    // Call to "PathRemoveExtension".
	PathRemoveExtension(lpStr1);

	// Print the path without the extension.
	cout << "\nThe path without extension is       : " << lpStr1 << endl;

}
OUTPUT:
==================
The path with extension is          : C:\TEST\sample.txt

The path without extension is       : C:\TEST\sample

Up Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.