BLUF:在这个函数中,\'提示错误信息而不是\?,为什么?
char key[] = "\a\b\f\n\r\t\v\\\'\"#%&*;:<>\?/{|}~";
if (strpbrk(*local_str, key) != NULL )
{
vico_param_out->out_valid = false;
AfxMessageBox("L'identifiant de numérisation est invalide. Vous avez saisi des caractères qui ne peuvent pas faire partie d'un nom de fichier windows (\"#%&*;:<>\?\\/{|}~). Veuillez faire les corrections nécessaires.");
}
这段代码应该检查输入字符串 (*local_str) 中是否有一个无效字符。适用于其中一些,但如果某些字符如 \? 在 *local_str 中。它接受它并且不显示错误消息。我没有t understand what
发生。
示例:ABC 有效
AB' 无效,提示信息更正
AB?无效但通过
A'?无效,但也失败了。
请帮忙。我很适应这个社区。
编辑:问题解决了。我似乎这个函数有效,但我不知道的另一个过程是在调用我的函数之前将 local_str 中的键作为快捷方式捕获,因此出现了奇怪的行为。当输入每次击键时,我移动了要评估的函数。
对您的打扰表示最深切的歉意。谢谢大家。