PathIsFileSpec function
Searches a path for any path-delimiting characters (for example, ':' or '\' ). If there are no path-delimiting characters present, the path is considered to be a File Spec path.
Syntax
BOOL PathIsFileSpec( _In_ LPCTSTR lpszPath );
Parameters
- lpszPath [in]
-
Type: LPCTSTR
A pointer to a null-terminated string of maximum length MAX_PATH that contains the path to be searched.
Return value
Type: BOOL
Returns TRUE if there are no path-delimiting characters within the path, or FALSE if there are path-delimiting characters.
Examples
#include <windows.h> #include <iostream.h> #include "Shlwapi.h" void main( void ) { // Path 1 string. char buffer_1[ ] = "sample"; char *lpStr1; lpStr1 = buffer_1; // Path 2 string. char buffer_2[ ] = "C:\\TEST\\sample"; char *lpStr2; lpStr2 = buffer_2; //Return value from "PathIsFileSpec". int retval; // Test path 1 for file spec. retval = PathIsFileSpec(lpStr1); cout << "The path to verify file spec is : " << lpStr1 << endl; cout << "PathIsFileSpec returns TRUE and is : " << retval << endl; // Test path 2 for file spec. retval = PathIsFileSpec(lpStr2); cout << "\nThe path to verify file spec is : " << lpStr2 << endl; cout << "PathIsFileSpec returns FALSE and is : " << retval << endl; } OUTPUT: ============== The path to verify file spec is : sample PathIsFileSpec returns TRUE and is : 1 The path to verify file spec is : C:\TEST\sample PathIsFileSpec returns FALSE and is : 0
Requirements
|
Minimum supported client |
Windows 2000 Professional, Windows XP [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
|
Unicode and ANSI names |
PathIsFileSpecW (Unicode) and PathIsFileSpecA (ANSI) |