string fn_sGenTextSignature(const string &str)
{
const char *head = str.c_str(); const char* chpTag[] = {"。", ",", ",", "\n", "."}; char *p = NULL;
int iSize = DIM(chpTag);//DIM =( sizeof(chpTag) / sizeof(chpTag[0])) for(int i=0; i<iSize; i++) { p = strstr(head, &chpTag[i]); -->错误在这里
if(p != NULL)
break; }//for
error C2665: 'strstr' : none of the 2 overloads could convert all the argument types 感觉参数类型并没有错误,请问要如何修改?
{
const char *head = str.c_str(); const char* chpTag[] = {"。", ",", ",", "\n", "."}; char *p = NULL;
int iSize = DIM(chpTag);//DIM =( sizeof(chpTag) / sizeof(chpTag[0])) for(int i=0; i<iSize; i++) { p = strstr(head, &chpTag[i]); -->错误在这里
if(p != NULL)
break; }//for
error C2665: 'strstr' : none of the 2 overloads could convert all the argument types 感觉参数类型并没有错误,请问要如何修改?
貌似有宽字符
p = strstr(head, chpTag[i]);
p = strstr(head, chpTag[i]); 也不行,还是同样的错误
1-〉const char *p = NULL;
2-〉char *head = str.c_str();
char* chpTag[] = {"。", ",", ",", "\n", "."}; 其实是Const的问题 你定义了const的参数,那么返回的也是const
The strstr function returns a pointer to the first occurrence of strCharSet in string. The search does not include terminating null characters. wcsstr and _mbsstr are wide-character and multibyte-character versions of strstr. The arguments and return value of wcsstr are wide-character strings; those of _mbsstr are multibyte-character strings. These three functions behave identically otherwise.