|
发表于 2003-9-28 21:03:32
|
显示全部楼层
1.
- void clear_screen()
- {
- #if defined(WIN_32)
- system("cls")
- #endif
- #if defined(LINUX)
- system("clear")
- #endif
- }
复制代码
This is a system call under linux, calling system command "clear" to clear terminal screen.
It is the simplest way.
2.
- /* clearscreen.c clear terminal screen */
- #include <stdio.h>
- #include <ncurses.h>
- main()
- {
- initscr();
- clear();
- refresh();
- endwin();
- printf("Hello, world!");
- }
- compile with:
- # cc -o clearscreen clearscreen.c -lncurses
复制代码
It is a more effective way under linux, looks like more standard.
3.
- void cls()
- {
- for(i=0; i<=25; ++i)
- printf("\n");
- return(0)
- }
复制代码
Oh, this is more portable way under either linux or win32, but not the best. |
|