At present, most of the domestic banking industry computer application systems use terminal business data to enter, business data printing, with end-end business processing on UNIX operating system platforms. The author introduces several ways to print under UNIX:
I. Overview
Under the UNIX environment, the terminal print is supported by the operating system, using the function provided by the terminal, implements the terminal print with the command or program. The specific process is: performing the print control command on the terminal to enable the terminal into the print state, and notify the printer ready to prepare, enter the file name to print files on the terminal to print. After printing, execute the print control command on the terminal to exit the print state.
Second, printing method
1. Implement printing with the hotkey function provided by the terminal itself. Various types of terminals provide the user with the printing hotkey. Just press the printing hotkey terminal to enter the print state, usually use the CAT command to print the file name to print file, print, then press the print hot button You can exit the print state. The copy print hot button of the HT-382 series terminal is Ctrl-F2.
2. Use the shell command to implement the terminal print. The UNIX operating system provides an interactive interpretation command language shell that can easily implement terminal printing. First, find the control command of the terminal print, and also take the HT-382 series terminal as an example, enter the copy print control command is ESC [5i, exiting the copy print control command is ESC [4i. Use VI to edit a shell command print file as follows:
Echo 'ESC [5i' # terminal enters the print state
Cat $ 1 # Print file
ECHO 'ESC [4i' # terminal exits the print state
On the terminal or in the program, this shell print command is executed, followed by the file name to print the file.
3. Use the C language to implement the terminal print. Also use the HT-382 series terminal as an example, write the terminal print program with the C language as follows:
#Include
Main (Argc, Argv)
INT ARGC;
Charargv []
{
CHAR N;
Printf ("/ 033 / [/ 5 / i");
/ Terminal enters the print state /
Sprintf (n "CAT% S", Argv [0]);
/ feed into the print file name /
System (n); / print file /
Printf ("/ 033 / [/ 5 / i");
/ Terminal exits print status /
}
Simply print the file name to print the file later in this program.
Three, pay attention to
1. Terminal printing should be set to the terminal settings in the terminal settings to the terminal connection print type.
2. Terminal printing can select the screen print according to the business requirements (only print screen display content), copy print (side-screen display file content), transparent print (print, no file content).
3. SHELL print command, the editing of the escape character ESC should press the CTRL-V key first, then press the ESC key to write.
4. Concluding the characters in the language print program, use 8 credit, and the front plus the sense character "/". For example, the ESC 8 credit ASCII code is 33, and "/ 033" is written in the program.