tchar string 截取子串
发布网友
发布时间:2022-07-13 15:33
我来回答
共1个回答
热心网友
时间:2023-11-04 16:31
#include <tchar.h>
#include <stdio.h>
#include <string.h>
#define MAX_PATH 260
#define _UNICODE //本行可有可无
TCHAR path1[MAX_PATH]=_T("E:\\folder\\watch folder");
TCHAR path2[MAX_PATH]=_T("watch folder");
TCHAR *p;
int main() {
p=_tcsstr(path1,path2);
if (p==(TCHAR *)path1+(_tcslen(path1)-_tcslen(path2))) {
_tprintf("[%s] end with [%s]\n",path1,path2);
} else {
_tprintf("[%s] NOT end with [%s]\n",path1,path2);
}
return 0;
}
//[E:\folder\watch folder] end with [watch folder]
//