I'm triying to read a string with a specific format in C using scanf() The string has the format:
<LET,LET,LET> op
where LET is a capital letter and op has to be '+' or '%'.
These are valid entries:
<A,B,C> +
<A,W,Z> %
<Q, X,W> +
These are not:
<A,b,C> +
<A,W,Zddddd> %
<Q,X,W> *
I'm trying something like this
#include <stdio.h>
int ret = 0;
char str[8];
ret = scanf("%8[^\n]",str);
but str ends up with garbage. I just don't know how to read it and how to get only capital letters.
Thanks
"<A,W,Zddddd> % qwerty"work or fail?