Sponsored Content
Full Discussion: clear screen
Top Forums Programming clear screen Post 25666 by Esaia on Friday 2nd of August 2002 10:19:00 AM
Old 08-02-2002
Quote:
Originally posted by hell666
Try this:

Code:
#include <curses.h>

int  main(void)
{
     initscr();
     clear();
     refresh();
     endwin();
}

And compile with:
cc prog.c -o prog -lcurses
Ok, thanks!
There is an other way else with:
#include <stdlib.h>
int main(void)
{
system("clear");
}

but there is allways fun to explorer new ways in doing things Smilie
I will go straight home now and read the manpages inside and out Smilie

later!
 

10 More Discussions You Might Find Interesting

1. Programming

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. (2 Replies)
Discussion started by: giannicello
2 Replies

2. Programming

clear screen in g++

How do I clear screen in g++ I've included curses and tried compile with lcurses as per gcc but fails, I can clear by using system("clear") but would prefer to use the curses library if possible. (2 Replies)
Discussion started by: gefa
2 Replies

3. Shell Programming and Scripting

Clear screen in NAWK

Hello guys, I wonder if it is possible to clear out the screen in AWK. I'm printing out mail messages and I would like every message starting on the beginning of the screen. When I use FOR loop and printf("\n") it clears out the screen but my text is somewhere in the middle of the screen. ... (2 Replies)
Discussion started by: petoSVK
2 Replies

4. Programming

how to clear screen in GDB session

hi , Could any one tell me the command for clearing the screen in GDB session (1 Reply)
Discussion started by: useless79
1 Replies

5. UNIX for Dummies Questions & Answers

how to clear history

Hi... i have one doubt pls... 1)can we clear the command line history in UNIX for a paricular login(scadm/root)if so how?. 2) can we see the time at which command executed. history is showing like : 100 display 101 lock 102 exit (7 Replies)
Discussion started by: gincemathew
7 Replies

6. OS X (Apple)

Virtual screen accessed by Screen Sharing

Hi, I'm trying to create a virtual screen, (maybe xvfb? or any other virtual screen buffer) and be able to use Screen Sharing to connect to it. The setup is that I have a Mac Mini connected to the TV. But when my girlfriend is using Front Row, I can't use Screen Sharing at the same time from... (0 Replies)
Discussion started by: linge
0 Replies

7. Shell Programming and Scripting

Clear Screen Command for BASH shell

I am unable to use clear or cls command on bash shell. I have recently installed Cygwin and am using that for practicing unix commands. I see that I can use Ctrl + L to clear the screen. I created an alias in my .bashrc to do the same as alias cls='^L' This is how i defined other aliases ... (4 Replies)
Discussion started by: erora
4 Replies

8. Red Hat

command line tool to disable screen lock and/or screen saver

Hi, I have a simple question : how to disable screen lock and/or sreen saver with command line with RHEL5.4 ? (1 Reply)
Discussion started by: albator1932
1 Replies

9. UNIX for Dummies Questions & Answers

Accidentally made a screen within a screen - how to move it up one level?

I made a screen within a screen. Is there a way to move the inner screen up one level so that it is at the same level as the first screen running from the shell? (2 Replies)
Discussion started by: phpchick
2 Replies

10. Shell Programming and Scripting

Clear specific part of the screen

I want to clear specific part of the screen. Say for example , i am running a bash script for i in {1..100} do echo "Current Record = $i" done if i use a clear command over there , it will clear my screen however when i scroll up i would have the old records , is there anyway in unix to... (5 Replies)
Discussion started by: chidori
5 Replies
clear(3NCURSES) 														   clear(3NCURSES)

NAME
erase, werase, clear, wclear, clrtobot, wclrtobot, clrtoeol, wclrtoeol - clear all or part of a curses window SYNOPSIS
# include <curses.h> int erase(void); int werase(WINDOW *win); int clear(void); int wclear(WINDOW *win); int clrtobot(void); int wclrtobot(WINDOW *win); int clrtoeol(void); int wclrtoeol(WINDOW *win); DESCRIPTION
The erase and werase routines copy blanks to every position in the window, clearing the screen. The clear and wclear routines are like erase and werase, but they also call clearok, so that the screen is cleared completely on the next call to wrefresh for that window and repainted from scratch. The clrtobot and wclrtobot routines erase from the cursor to the end of screen. That is, they erase all lines below the cursor in the win- dow. Also, the current line to the right of the cursor, inclusive, is erased. The clrtoeol and wclrtoeol routines erase the current line to the right of the cursor, inclusive, to the end of the current line. Blanks created by erasure have the current background rendition (as set by wbkgdset) merged into them. RETURN VALUE
All routines return the integer OK on success and ERR on failure. The SVr4.0 manual says "or a non-negative integer if immedok is set", but this appears to be an error. X/Open defines no error conditions. In this implementation, functions using a window pointer parameter return an error if it is null. NOTES
Note that erase, werase, clear, wclear, clrtobot, and clrtoeol may be macros. PORTABILITY
These functions are described in the XSI Curses standard, Issue 4. The standard specifies that they return ERR on failure, but specifies no error conditions. Some historic curses implementations had, as an undocumented feature, the ability to do the equivalent of clearok(..., 1) by saying touch- win(stdscr) or clear(stdscr). This will not work under ncurses. This implementation, and others such as Solaris, sets the current position to 0,0 after erasing via werase() and wclear(). That fact is not documented in other implementations, and may not be true of implementations which were not derived from SVr4 source. Not obvious from the description, most implementations clear the screen after wclear even for a subwindow or derived window. If you do not want to clear the screen during the next wrefresh, use werase instead. SEE ALSO
ncurses(3NCURSES), outopts(3NCURSES), refresh(3NCURSES) clear(3NCURSES)
All times are GMT -4. The time now is 02:45 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy