-3

I am interested in creating a terminal-based text interface in C without the use of a library like ncurses. I know that through using tput and a variety of escape codes, it is possible to create such an interface. However, I am uncertain of how to use tput or similar commands in C.

First, I am wondering what the best option is for implementing something like this in C without external libraries (so it can be compiled and run on a bare bone system).

Second, if using tput is the best option, how can I call these commands from C?

I understand that using a pre-existing library, such as ncurses would greatly simplify the process, but I would like to create my program without them.

Thank you in advance.

w m
  • 493
  • 1
  • 5
  • 7
  • If you want to create a text mode interface, you almost certainly *DO* want to use a library like ncurses. Honest! The "overhead" is modest; the productivity gains and improvements in program robustness are enormous. – paulsm4 Apr 09 '16 at 23:54
  • 1
    Beyond the obvious: calling `tput` using `system` or `popen`, `tput` uses ncurses anyway. `tput` is useful for *shell scripts*. – Thomas Dickey Apr 10 '16 at 00:00

1 Answers1

1

The standard C library does not provide any functions that can be used instead of the functions in ncurses. You'll have to use ncurses or another third party library that provides the equivalent functionality.

R Sahu
  • 204,454
  • 14
  • 159
  • 270
  • Is there not a way I could call tput or similar commands directly from C? – w m Apr 09 '16 at 23:53
  • When you say "directly from C", I assume you mean "is there any such function in the standard C library". The answer is "No". – R Sahu Apr 09 '16 at 23:55