Contents Index Topic Contents | ||
Previous Topic: PathFindFileName Next Topic: PathFindOnPath |
PathFindNextComponent
LPTSTR PathFindNextComponent( LPCTSTR pszPath );Parses a path for the next path component. Paths are delimited by backslashes or by the NULL at the end of the path.
- Returns the address of the start of the next path component if successful, or NULL otherwise.
- pszPath
- Address of the path to search.
Example:
#include <windows.h> #include <iostream.h> #include "Shlwapi.h" void main( void ) { // Path to find the next part. char buffer_1[] = "c:\\path1\\path2\\test"; char *lpStr1; lpStr1 = buffer_1; cout << "Search a path for the next path component " << "after the root " << lpStr1 << endl; cout << "Return the next path component: \"" << PathFindNextComponent(lpStr1) << "\"" << endl; cout << "\nSearch a path for the next path component " << "after the root \"c:\\path1\\path2\"" << endl; cout << "Return the next path component: \"" << PathFindNextComponent("c:\\path1\\path2") << "\"" << endl; cout << "\nSearch a path for the next path component " << "after the root \"c:\\path1\"" << endl; cout << "Return the next path component: \"" << PathFindNextComponent("c:\\path1") << "\"" << endl; } OUTPUT: =========== Search a path for the next path component after the root c:\path1\path2\test Return the next path component: "path1\path2\test" Search a path for the next path component after the root "c:\path1\path2" Return the next path component: "path1\path2" Search a path for the next path component after the root "c:\path1" Return the next path component: "path1"
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.