In linux, use conio. h-Linux general technology-Linux programming and kernel information. The following is a detailed description. In fact, there is no conio. h file in linux. To implement functions similar to gotoxy () in BC, you can use curses
# Include
Initialization should be performed before using curses, and injection should be performed after use-these operations call initscr () endwin () respectively to complete.
Main (){
Initscr ();
.
.
.
Endwin ();
}
NOTE: If compilation fails, you can add the-lcurses parameter to introduce the curses library.
Common cureses functions include:
Cbreak ()
Nocbreak ()
Calling cbreak () will read all characters except the output control character (del, ctrl), opposite to nocbreak ()
Nl ()
Nonl ()
Essentially, when you press the Enter key, two characters are generated, one carriage return and one line feed.
If you call nl (), replace the two input characters with "\ n", and replace "\ n" with carriage return and line feed.
Nonl () opposite
Echo () echo
Noecho ()
Keypad (win, bf)
To read the direction key, you must call this function first. curses will convert the direction key to a predefined number, as shown below:
Win is a WINDOW pointer, which is usually passed into the standard screen handle stdscr.
Bf is true | false
Refresh ()
In curses, all output information is not displayed on the screen instantly, but cached. You must use
Refresh () to change the screen. It means that the white point is to display the content in the screen cache to the screen and clear the cache.
Move (y, x)
Getyx (win, y, x) is correct. It's y, x, not & y, & x ---- This is a macro defined in the file.
Clear ()
Erase () should be used in combination with refresh ()
Echochar (c)
Addch (c)
Mvaddch (y, x, c) first move to and then output
Addstr (str)
Mvaddstr (y, x, str)
Printw (format, str) is similar to printf ()
Mvprintw (y, x, format, str)
Int getch ()
Getstr () // this parameter is unknown
Scanw (format, & v1, & v2,...) is similar to scanf ()
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.