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 length MAX_PATH that contains the path and file name. When this function returns successfully, the string contains only the file name, with the path 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 Version | shlwapi.dll version 4.71 or later |
|---|
| Custom Implementation | No |
|---|
| Header | shlwapi.h |
|---|
| Import library | shlwapi.lib |
|---|
| Minimum operating systems |
Windows 2000, Windows NT 4.0 with Internet Explorer 4.0, Windows 98, Windows 95 with Internet Explorer 4.0 |
|---|
| Unicode | Implemented as
ANSI and Unicode versions. |
|---|