Coding a shell-like interface
I'm new to the board and rather new to programming for linux as well. but I'm glad I do that now, since it's a lot of fun! ;)
Currently I write some app that is going to use a shell-like interace, where app-internal commands are recognized and executed. To achieve this I did the following (which is no longer a problem, but I thought i let you all know so you maybe have a point on something):
first i wrote some code to read from stdin to a buffer minding an overrun.
then i wrote a little procedure that checks for known commands and there syntax using the <regex.h>.
if a valid command is given it is then passed to it's execution procedure/function.
and now my problem:
when you push the arrow-keys or any other specialkey, you see it's escapecode on screen and when you then press enter what you read from stdin is totally messed up...
to read from stdin I use getchar().
what I NEED is to eliminate those specialkeys (only way I can think of right now is: read(char) probe(char) buffer(char))
and what I'd LIKE to have is to use at least the arrowkeys to browse an internal command history.
I thought of using gnu history but it is way too powerful for my little concern and it doesn't tell you anything about arrowkeys in the documentation..
:confused: :confused: :confused:
do you know of a save way to do that?
or maybe you know of some free code I could use?
thanks a lot! :rolleyes: