Export (0) Print
Expand All

PathRemoveBlanks function

Removes all leading and trailing spaces from a string.

Syntax


void PathRemoveBlanks(
  _Inout_  LPTSTR lpszString
);

Parameters

lpszString [in, out]

Type: LPTSTR

A pointer to a null-terminated string of length MAX_PATH from which to strip all leading and trailing spaces.

Return value

This function does not return a value.

Examples


#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|<----

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server [desktop apps only]

Header

Shlwapi.h

Library

Shlwapi.lib

DLL

Shlwapi.dll (version 4.71 or later)

Unicode and ANSI names

PathRemoveBlanksW (Unicode) and PathRemoveBlanksA (ANSI)

 

 

Community Additions

ADD
Show:
© 2014 Microsoft