Monday, February 14, 2011

How to use ncurses functions

A colorful teams UNIX terminal features ncurses based on text-based interface.

Libraries can create Windows function-key mapping, screen painting functions programmer side by side. Ncurses functions supports eight colours and the use of mice that can compensate for the lack of a real GUI. Difficulty: difficult

Instructions
  1. 1

    Download ncurses-resources.

It is offered for free from a number of sources. The download will include all the libraries and support utilities.
  • 2

    Add curses.h in your source code.

  • Links to files of the curses library code. Add the parameter lcurses to the GCC command.
  • 3

    Initialize the screen by calling the function "Initscr."

  • It shows memory for variables prepare ncurses functions and the library for use. It enables with structures of ncurses WINDOW functions to work.
  • 4

    Refresh the screen after you have made changes to the State of the window and the cursor.

  • The discount will only be changed to the contents of the window, which allows to save CPU time and to prevent overwriting the redundant information to update. Standard calls are "Update" and "Wrefresh".
  • 5

    Take advantage of the logical cursor.

  • While there is a single physical cursor, a logical cursor that allows you to write without redirecting the physical cursor to any location in any window can all Windows.
  • 6

    Clear window, rather than the entire screen of compensation.

  • Compensation features ncurses functions for both, butSave as the window that must be removed to CPU time and avoid overwriting what is already on the screen.
  • 7

    Indicative of the function keys to accept a window to enable.

  • "_Use_keypad" must be added to each window to comments function keys indicator. Be sure to assign a variable ch.har the value to an int variable. The capacity to organize the numeric values of the function keys have char variables.

    No comments:

    Post a Comment