Contents Index Topic Contents | ||
Previous Topic: PathIsRelative Next Topic: PathIsSameRoot |
PathIsRoot
BOOL PathIsRoot( LPCTSTR pPath );Parses a path to determine if a root directory path part exists.
- Returns TRUE for a valid root path, or FALSE otherwise.
- pPath
- Address of the path to be validated.
Example:
#include <windows.h> #include <iostream.h> #include "Shlwapi.h" void main( void ) { // String path name 1. char buffer_1[] = "C:\\"; char *lpStr1; lpStr1 = buffer_1; // String path name 2. char buffer_2[] = "path\\file"; char *lpStr2; lpStr2 = buffer_2; // Variable to get the return from "PathIsRoot". int retval; // Test case with path not absolute. retval = PathIsRoot(lpStr1); cout << "The return from function is :" << retval << endl; cout << "The path does contain a root part :" << lpStr1 << endl; // Test case with path absolute. retval = PathIsRoot(lpStr2); cout << "The return from function is :" << retval << endl; cout << "The path does not contain part :" << lpStr2 << endl; } OUTPUT: ============ The return from function is :1 The path does contain a root part :C:\ The return from function is :0 The path does not contain part :path\file ============
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.