The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
how to clear screen in GDB session useless79 High Level Programming 1 09-06-2007 07:59 PM
Clear log file in use. coolbhai UNIX for Advanced & Expert Users 10 06-20-2007 06:37 AM
Clear screen in NAWK petoSVK Shell Programming and Scripting 2 05-21-2006 08:01 PM
clear screen in g++ gefa High Level Programming 2 04-22-2006 06:00 AM
clear screen immanuelgangte High Level Programming 6 08-02-2002 09:09 AM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-13-2002
Registered User
 

Join Date: Sep 2001
Location: Phoenix
Posts: 76
How to clear screen

I searched the post and someone said to clear the screen in C, use

printf("\033[2J"); ??

However, this doesn't work...typo or no.

What is an equivalent command to 'CLS' in DOS/'clear' in UNIX to clear the screen and go to top of screen??

Thank you.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 05-14-2002
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,318
Take a look at the curses package. You probably have a "man curses" or "man curses_intro" or something. Curses has a routine clear() that should do what you want. I think you will need to call initscr() once in the program first to set stuff up.

For this to work your TERM variable must be set correctly and you must have a good entry in termcap or terminfo. If can run a full screen editor like vi then you should ok. vi uses curses.
Reply With Quote
  #3 (permalink)  
Old 05-14-2002
J.P's Avatar
J.P J.P is offline
Registered User
 

Join Date: Nov 2001
Location: Sweden
Posts: 67
This should give you an answer to your question:

http://www.comeaucomputing.com/techtalk/#clearscreen

A really good FAQ, but mostly C++ though
__________________
[ Please put signature here ]
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 03:06 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0