Dedicated web hosting - 770 Part VI . Programming in Linux Linux

770 Part VI . Programming in Linux Linux Programming Interfaces As defined at the beginning of this chapter, a programming interface refers to the rules or methods followed to accomplish a particular task. Like programming environments, programming interfaces are usually thought of as either graphical or command line. Graphical interfaces use the X Window System to receive and process user input and display information. Command-line interfaces, sometimes referred to as textmode user interfaces (TUIs), are strictly text-based and do not require a windowing system to run. Thanks to the X Window System, however, you can also execute CLIbased programs in terminal emulators running on top of X. There also is a third type of interface: an application programming interface or API. This section of the chapter looks at the ncurses library used to create text-mode user interfaces, examines some of the popular graphical interfaces in use today, and describes a small set of the most popular APIs used by Linux programmers. Creating Command-Line Interfaces There are three primary means of creating programs that interact with users at the command line. Two use libraries of screen manipulation routines, S-Lang and ncurses, to create TUIs and the third just uses standard input and standard output, conventionally known as stdin and stdout, respectively. Using stdin and stdout is trivially simple. Input and output occur one line at a time; users type input using the keyboard or pipe input in from a file, and output is displayed to the screen or redirected to a file. Listing 28-2 shows such a program, readkey.c. Listing 28-2: Reading and Writing to stdin and stdout /* * readkey.c - reads characters from stdin */ #include int main(int argc, char *argv[]) { int c, i = 0; /* read characters until newline read */ printf( INPUT: ); while ((c = getchar()) != n ) { ++i;
Please visit Domain Name Hosting services for high quality webhost to host and run your jsp applications.

Leave a Reply