Page 1 of 1

getchar() or similar?

Posted: Tue Jul 11, 2017 5:48 am
by al3x-h
Hi, I need to a function to block until the user hits the keyboard. From my brief search, it seems like

Code: Select all

getchar/fgets
are good candidates. I've had little success with

Code: Select all

getchar
and

Code: Select all

fgets
even though the code compiles, it seems like they don't really work. I notice that stdin has been redirected, so in theory

Code: Select all

getchar
should work? Has anyone been able to get any of the stdin functions to work? Or is there a way to make API calls for UART0 (which I believe is used for printf) so I can use the USB-Serial interface on my dev board?

Re: getchar() or similar?

Posted: Tue Jul 11, 2017 8:45 am
by ESP_Sprite
If I recall correctly, standard serial IO is non-blocking on the ESP32, meaning getchar() always immediately returns. Is that what you're seeing?