Tool/software: TI C/C++ Compiler
Does code composer studio have support for a non-blocking getchar function? I'm trying make an infinite loop that checks to see if a character is available at that moment; if it's not, I want it to continue in the loop to do other functions. Here's an example:
while(1) {
/* stuff to be done every loop*/
...
c = getchar();
if(c=='t') { /* do stuff*/ }
}
In this case, if the user doesn’t hit enter, the if statement will never be reached. My original idea to avoid the blocking was to add either a getchar function that doesn’t block (getch) or to check and see if the keyboard was hit before getting a character (kbhit). However, both of these functions require access to the terminal through termios.h, an external library. There are other libraries that will do what I want (i.e. ncurses.h, conio.h), but they all seem to be open source and not available on CCS.
Is there a feasible way to accomplish what I want in CCS? I would prefer to avoid multi-threading. Thanks for your help!