Results 1 to 4 of 4
hi , i write C program in TC ( turbo C ) . there is a command " clrscr() " to clear the screen. i need equivalent command in linux ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 12-25-2003 #1Just Joined!
- Join Date
- Dec 2003
- Location
- x1234
- Posts
- 4
how to clear screen(g++ compiler)
hi , i write C program in TC ( turbo C ) . there is a command " clrscr() " to clear the screen. i need equivalent command in linux so that i can use that in my program. i am usuing g++ compiler.
i write
Code:#include<stdio.h> #include<conio.h > void main() { int x; clrscr(); // what is the equivalent command in linux and its header??? printf("hi"); // other codes getch(); }
plz give one sample code how to use that?
thanks [/code]
- 12-25-2003 #2Linux Guru
- Join Date
- Apr 2003
- Location
- London, UK
- Posts
- 3,284
Re: how to clear screen(g++ compiler)
a few methods:
Originally Posted by ugotamail
1) Ncurses. This is a C libary and i beleive it may have something there to do what you want.
2) system() call. "man 3 system", its in stdlib.h IIRC, just call system("clear"); (this may not work, i dont know)
3) int i; for(i=0; i != 60; i++) printf("\n");
- 12-25-2003 #3Just Joined!
- Join Date
- Dec 2003
- Location
- x1234
- Posts
- 4
yes its working.i have checked it.....thankssystem("clear");
- 12-25-2003 #4Linux Guru
- Join Date
- Oct 2001
- Location
- Täby, Sweden
- Posts
- 7,578
That's not really the best solution, though. "clear" is just another ncurses program that only uses the clear call from the ncurses library. It's really much cheaper to call the clear function directly from your program instead of forking and execing.



