Console in Linux

Programming, for all ages and all languages.
Post Reply
GenX

Console in Linux

Post by GenX »

Hey,

I am writing a console program in c to manipulate a disk that will have my own filesystem installed, I want to be able to divide the console into 3 sections, 1 for disk information another for command line and another for command line output. The program will be like a mini shell.

How can I take control of the console in this way from within a standard console program?

Cheers.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Console in Linux

Post by Solar »

If you refer to plain vanilla Standard C, not at all. C is line-oriented, and does know nothing about a terminal window.

Under Unix systems, the ncurses library provides functions to handle terminal apps like you described. Don't know about Windows.
Every good solution is obvious once you've found it.
GenX

Re:Console in Linux

Post by GenX »

Hey,

It doesn't have to be plain c, I am happy to use libraries. Is there no system calls that would allow me to do this? I know that in windows you can get direct access to the console buffers using the API, I just thought it would be similar for linux.

Anyway, thanks for the info I will check out the ncurses library.

Cheers.
User avatar
df
Member
Member
Posts: 1076
Joined: Fri Oct 22, 2004 11:00 pm
Contact:

Re:Console in Linux

Post by df »

I would use GLK, that means you can compile it as console app or XTerm app (or win32 glk app.....)..

create 3 windows, set one active, print to it, get input etc.

(glk was designed for interactive fiction, so its great for splitting windows, and doing user input etc)..

glkterm (console linux glk) uses ncurses.

glk is cool.
-- Stu --
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:Console in Linux

Post by Pype.Clicker »

ANSI escape code could help too ... but i second that libncurses is what's usually used for those cases ...
Post Reply