Weird fgets and gets behavior
Weird fgets and gets behavior
Was trying to use fgets or gets for user input. The functions don't wait for a newline. They seem to time out in about a sec and return whatever characters were typed.
Re: Weird fgets and gets behavior
Looks like you have to implement your own version of the function using getchar. Which is non blocking as well and will return immediately. So you need to put a sleep/delay in whenever you don't get a char.
Re: Weird fgets and gets behavior
By default, reading from stdin is non-blocking. If you install the UART driver, you should be able to do blocking reads. Please see examples/system/console for an example of how to enable blocking reads from stdin. Also please see https://docs.espressif.com/projects/esp ... out-stderr
Re: Weird fgets and gets behavior
Oh cool! Thanks for the info.
John A
John A
Who is online
Users browsing this forum: No registered users and 86 guests