PathQuoteSpaces function
Searches a path for spaces. If spaces are found, the entire path is enclosed in quotation marks.
Syntax
BOOL PathQuoteSpaces( _Inout_ LPTSTR lpsz );
Parameters
- lpsz [in, out]
-
Type: LPTSTR
A pointer to a null-terminated string that contains the path to search. The size of this buffer must be set to MAX_PATH to ensure that it is large enough to hold the returned string.
Return value
Type: BOOL
TRUE if spaces were found; otherwise, FALSE.
Examples
#include <windows.h> #include <iostream.h> #include "Shlwapi.h" void main(void) { // Path with spaces. char buffer_1[MAX_PATH] = "C:\\sample_one\\sample two"; char *lpStr1; lpStr1 = buffer_1; // Path before quote spaces. cout << "The path before PathQuoteSpaces: " << lpStr1 << endl; // Call "PathQuoteSpaces". PathQuoteSpaces(lpStr1); // Path after quote spaces. cout << "The path after PathQuoteSpaces: " << lpStr1 << endl; } OUTPUT: ================== The path before PathQuoteSpaces: C:\sample_one\sample two The path after PathQuoteSpaces: "C:\sample_one\sample two"
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 |
PathQuoteSpacesW (Unicode) and PathQuoteSpacesA (ANSI) |