PathFindNextComponentPathFindNextComponent*
*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.

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"

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