+ 1
How can I forbid the use of characters?
How can I prevent the user from using letters other than the ones offered in a program's options/parametters?
3 Answers
+ 1
You can either filters those characters out, or return an error message and let them enter a different input
+ 2
What I am trying to do is to sanitize the input, I already have a part of my code that prevents the use of numbers...
If (character <= 0 || character >= 0){
printf (.......);
exit (1);
}
But now I want to prevent the use of certain letters that do not provide any functionality in the program, like let's suppose z, v, r, et cetera.
+ 2
Have a look at the c standard lib string.h that should contain a method to do the job. However, regex are also a way to go.