2014-04-23:去掉路径最后的反斜杠

#include 
#include 
#include 
#include 


LPTSTR DeleteBlackslash(LPTSTR lpProfilePath)
{
	DWORD dwPathLength = 0 ;
	

	 dwPathLength = _tcslen(lpProfilePath) ;

	printf("length:%d",dwPathLength);

	if ( lpProfilePath[dwPathLength-1] == TEXT('\\') )
	{
		lpProfilePath[--dwPathLength] = (TCHAR)0 ; 
	}
	
	return lpProfilePath;
}

DWORD _tmain(int argc,LPTSTR argv[])
{
	LPTSTR	lpProfilePath = NULL ;
	TCHAR	szProfilePath[MAX_PATH+1];

	if (argc<2)
	{
		return 1;
	}
	
	_tcscpy(szProfilePath,argv[1]);

	lpProfilePath = DeleteBlackslash(szProfilePath) ;

	printf("Primary:%s\nNew ProfilePath:%s",argv[1],lpProfilePath);
	
	return 0;

}

你可能感兴趣的:(经典代码,windowsAPI,工作日志)