user1505399
user1505399

Reputation: 79

Using curses library to create GUI for different operating systems

It would appear that the curses library is specific to the operating system. Given this, I would like to know:

  1. Can the curses library be used in a non-standard operating system (as in not Windows, Linux, Mac OS, so on...)?; and,
  2. If the curses library is not limited to those operating systems, would I have to write my own implementation of the functions described in the library or could I simply call the functions in a similar fashion as in:

    #include <stdio.h>
    ...
    printf("%s", "something");
    

Upvotes: 0

Views: 780

Answers (2)

gpoo
gpoo

Reputation: 8638

For your first question, you can use curses in any Unix-like operating system, that includes Linux and MacOSX. Both of them provides curses. For the other operating system, you can check PDCurses. That said, you can make your code portable. However, I would not consider it for iOS, Android, etc (although still possible to do it).

For your second question, once you use curses you have to stick with that. You can not use the standard I/O. Curses provides its own directives to print out. Instead of printf, you would use printw. Check the "Hello world" example from the curses tutorial to get an idea.

Upvotes: 1

nhed
nhed

Reputation: 5999

The cures library primarily operates as an abstraction between the terminal capabilities and the application. I would say yes, you can theoretically implement anything

Your code snippet makes no sense in the context of the question.... where is the use of curses?

Your question is also unclear regarding the OS you want to use.

If you are looking for a shortcut you can probably use terminal escape codes directly

Upvotes: 0

Related Questions