大家帮我看看这段代码吧,判断浏览器中的汉字输入的,之前把已经把lpwcstr转换成char*了,程序允许有‘*‘和汉字。但现在老是出现数组越界的问题,在IE理报错,什么isctype.c (unsigned)(c+1)<=256一类的东西,应该就是数组越界的问题了吧?大家看这代码写得哪有什么问题吗?有什么好的建议,一定告诉兄弟我
谢谢了阿!int isChineseExcept2Stars(char * full_url)
{
char * _url = full_url;
int leng = strlen(full_url); int result = 0; for (int index = 0; index < leng; index++)0
{
if (_url[index] == '*')
continue;
else if (_url[index] < 0)
{
result = 1; // 汉字
}
else
{
result = -1; // 非汉字
return result;
}
} return result;
}
谢谢了阿!int isChineseExcept2Stars(char * full_url)
{
char * _url = full_url;
int leng = strlen(full_url); int result = 0; for (int index = 0; index < leng; index++)0
{
if (_url[index] == '*')
continue;
else if (_url[index] < 0)
{
result = 1; // 汉字
}
else
{
result = -1; // 非汉字
return result;
}
} return result;
}
我之前用WideCharToMultiByte 把宽字转成窄字了,也就是把LPWCSTR转成CHAR*
汉字码应该是小于0的,所以用这个来判断
您继续说,愿听大家意见!!
debug assertion failed!program:c\program files\internet explorer\iexplorer.exe
file: isctype.c
line:cexpression:(unsigned)(c+1)<=256for information on how your program can cause an assertion
falure,see the visual c++ documentation on asserts.(press retry to debug the application)