hi, we are developing sample code for scanf & printf functions using retarget_io.c for stdin & stdout in cmsis rtos. we have implemented stdout_putchar & stdin_getchar functions in user code. printf is working fine. scanf also working if we are pressing a valid key in terminal. but by mistake an alphabet key (or any special character) is pressed for getting a decimal input (which allows only numeric keys), after that scanf function is not working. it is breaking immediately when a key is pressed (even valid key) and not waiting for enter key. what might be the issue?
This is the intended behavior of scanf. You can receive single characters to collect them to one string or you can read a complete string with gets(). After that, you can analyze it with sscanf().
hi, scanf function, will not wait for enter key to return from it even an invalid key pressed? thanks.