Contents Index Topic Contents | ||
Previous Topic: PathRemoveBackslash Next Topic: PathRemoveExtension |
PathRemoveBlanks
void PathRemoveBlanks( LPTSTR lpszString );Removes all leading and trailing spaces from a string.
- No return value.
- lpszString
- Address of the string from which to strip all leading and trailing spaces.
Example:
#include <windows.h> #include <iostream.h> #include "Shlwapi.h" void main( void ) { // Path with leading and trailing spaces. char buffer_1[] = " c:\\TEST\\File1\\File2 "; char *lpStr1; // |--------- leading & |-------- trailing spaces lpStr1 = buffer_1; // Path before "PathRemoveBlanks". cout << "Path before calling \"PathRemoveBlanks\": " << lpStr1 << endl; cout << "Dashes are only to indicate path width :" <<"\n---->|" << lpStr1 << "|<----" << endl; // Call function "PathRemoveBlanks". PathRemoveBlanks(lpStr1); // Path after "PathRemoveBlanks". cout << "\nPath after calling \"PathRemoveBlanks\": " << lpStr1 << endl; cout << "Dashes are only to indicate path width :" << "\n---->|" << lpStr1 << "|<----" << endl; } OUTPUT: ================== Path before calling "PathRemoveBlanks": c:\TEST\File1\File2 Dashes are only to indicate path width : ---->| c:\TEST\File1\File2 |<---- Path after calling "PathRemoveBlanks": c:\TEST\File1\File2 Dashes are only to indicate path width : ---->|c:\TEST\File1\File2|<----
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.