PathIsRelativePathIsRelative*
*Contents  *Index  *Topic Contents
*Previous Topic: PathIsPrefix
*Next Topic: PathIsRoot

PathIsRelative


BOOL PathIsRelative(
    LPCTSTR lpszPath
    );

Searches a path and determines if it is relative.

lpszPath
Address of the path to search.

Example:

#include <windows.h>
#include <iostream.h>
#include "Shlwapi.h"

void main( void )
{
	// String path name 1.
	char buffer_1[] = "test.exe";
	char *lpStr1;
	lpStr1 = buffer_1;

	// String path name 2.
	char buffer_2[] = "C:\\test.exe";
	char *lpStr2;
	lpStr2 = buffer_2;

	// Variable to get the return from "PathIsRelative".	
	int	retval;	

	// Test case with path not absolute.
	retval = PathIsRelative(lpStr1);
	cout << "The return from function is :" << retval << endl;
	cout << "The path is not absolute :   " << lpStr1 << endl;

	// Test case with path absolute.
	retval = PathIsRelative(lpStr2);
	cout << "\nThe return from function is :" << retval << endl;
	cout << "The path is absolute :       " << lpStr2 << endl;

}
OUTPUT:
==========
The return from function is :1
The path is not absolute :   test.exe

The return from function is :0
The path is absolute :       C:\test.exe

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