BLUF: In this function, \' prompt the error message but not \?, Why?
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.");
}
This snippet of code is supposed to check if one of the invalid caracters is in the input string (*local_str). Works well with some of them, but if some characters like \? are in *local_str. it accepts it and do not show the error message. I dont understand what
s happening.
Example:
ABC is valid
AB' is not valid, prompt mesage for correction
AB? is not valid but falls through
A'? is not valid but also falls through.
Please help. I am indepted to this community.
EDIT: Problem solved. I would seem that this function works but another process which I was unaware of was catching the keys in local_str as shortcuts before the call to my function, hence the weird behavior. I moved my function to be evaluated when each keystroke is inputed.
My deepest apologies for annoyance. Thanks you everyone.