Click to Rate and Give Feedback
MSDN
MSDN Library
User Interface
Windows Shell
Shell Reference
Path Functions
 PathStripPath Function

  Switch on low bandwidth view
PathStripPath Function

Removes the path portion of a fully qualified path and file.

Syntax

void PathStripPath(      
    LPTSTR pszPath );

Parameters

pszPath
[in, out] A pointer to a null-terminated string of maximum length MAX_PATH that contains the path and file name that will have the path portion removed.

Return Value

No return value.

Example

The following examples show the effect of PathStripPath on a series of strings.

TCHAR szPath1[] = TEXT("c:\\dir1\\file.txt");
PathStripPath(szPath1);
// Result: szPath1 == file.txt

TCHAR szPath2[] = TEXT("c:\\windows\\system32\\directx\\dinput\\joystick.ini");
PathStripPath(szPath2);
// Result: szPath2 == joystick.ini
    
TCHAR szPath3[] = TEXT("c:\\dir1\\dir2");
PathStripPath(szPath3);
// Result: szPath3 == dir2

TCHAR szPath4[] = TEXT("c:\\dir1\\dir2\\");
PathStripPath(szPath4);
// Result: szPath4 == dir2\

TCHAR szPath5[] = TEXT("c:\\");
PathStripPath(szPath5);
// Result: szPath5 == c:\ (no change)

TCHAR szPath6[] = TEXT("c:");
PathStripPath(szPath6);
// Result: szPath6 == c: (no change)

TCHAR szPath7[] = TEXT("Not a Path");
PathStripPath(szPath7);
// Result: szPath7 == Not a Path (no change)

Function Information

Minimum DLL Versionshlwapi.dll version 4.71 or later
Custom ImplementationNo
Headershlwapi.h
Import libraryshlwapi.lib
Minimum operating systems Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0
UnicodeImplemented as ANSI and Unicode versions.
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker