I was just wondering if there is any way of editing anything already
printed on the screen with out using the system("cls") command.
Not portably, since a standard-conformant implementation need not
involve anything resembling a "screen". There are a number of choices
available depending on your needs and platform, but none of them are
topical here.
--
C. Benson Manica | I *should* know what I'm talking about - if I
cbmanica(at)gma il.com | don't, I need to know. Flames welcome.
I was just wondering if there is any way of editing anything already
printed on the screen with out using the system("cls") command.
There is no portable way to do this.
The comp.lang.c FAQ is at <http://www.c-faq.com/>. You have asked
question 19.4.
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
I tried upper commands. Seems does not work proper as the explanations.
printf("\033[2J"); display"<-2j"
...........
could anyone tell me his results?
------------------------------------------------------
"Keith Thompson" <kst-u@mib.org?????? :ln8xlognww.fsf @nuthaus.mib.or g...
"someone" <randomuser5000 @gmail.comwrite s:
>I was just wondering if there is any way of editing anything already
>printed on the screen with out using the system("cls") command.
>
There is no portable way to do this.
>
The comp.lang.c FAQ is at <http://www.c-faq.com/>. You have asked
question 19.4.
>
--
Keith Thompson (The_Other_Keit h) kst-u@mib.org
<http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*>
<http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
I tried upper commands. Seems does not work proper as the explanations.
>
printf("\033[2J"); display"<-2j"
..........
could anyone tell me his results?
Perhaps your output device doesn't understand these ansi escape
codes, read its documentation.
I was just wondering if there is any way of editing anything already
printed on the screen with out using the system("cls") command.
There is no "C" way to do this, as C precedes most CRT terminals,
Even the few that existed back then cost about $3 to $15 THOUSAND
dollars each, and each had its own quirky control sequence for clearing
the screen. The first one I ever saw was in 1969, at a trade show,
made by Univac, and cost $15,000, retail.
and it's not clear terminal control falls under the baliwick of the C
language or th standard C libraries..
The most portable way is dorky, but works most every place I can think
of:
for( i=1; i <= 66 + 24 /* for those TALL full page displays,plus
lagniappe */; i++ )
puts( "\n" );
If your intended terminal has some alleged "ANSI" control code
capability, there's something gross, like puts( "\033;2J" ) that does
the trick, google for "termcap vt100" or ANSI and see the "cl" entry.
On 2006-08-17, Ancient_Hacker <grg2@comcast.n etwrote:
>
The most portable way is dorky, but works most every place I can think
of:
>
for( i=1; i <= 66 + 24 /* for those TALL full page displays,plus
lagniappe */; i++ )
puts( "\n" );
>
If your intended terminal has some alleged "ANSI" control code
capability, there's something gross, like puts( "\033;2J" ) that does
the trick, google for "termcap vt100" or ANSI and see the "cl" entry.
Most terminals, particularly modern ones, will clear the screen if
you simply send them a formfeed. It's not guaranteed, but it's a
similar kind of assumption to backspace will move the cursor left
which seems pretty much standard these days.
I'd agree looking at the termcap manual would be a good idea, though,
at least if the OP is talking about a serial terminal or an emulation
of one.
>I was just wondering if there is any way of editing anything already
>printed on the screen with out using the system("cls") command.
>
There is no "C" way to do this, as C precedes most CRT terminals,
Strange. Those CRT terminals that I was using regularly for more than
10 years before C existed. In fact, the first PDP-1 of 1957 had a CRT
display (which is iconized in the DECUS logo). I used plenty of VT05s
and VT52s (the later are still 4 years before C). Even the ANSI
standard X3.64 predates the publication of K&R1, although Heath's
implementation and DEC's VT100 were not yet out at K&R1's publication date.
On Thu, 17 Aug 2006 00:33:37 UTC, "someone" <randomuser5000 @gmail.com>
wrote:
I was just wondering if there is any way of editing anything already
printed on the screen with out using the system("cls") command.
>
No, because C does know nothing about a screen, TTY, printer or other
devises. So you may ask in a group related to POSIX or to your OS to
get a solution beside standard C.
On Thu, 17 Aug 2006 00:33:37 UTC, "someone" <randomuser5000 @gmail.com>
wrote:
>
>I was just wondering if there is any way of editing anything already
>printed on the screen with out using the system("cls") command.
>>
No, because C does know nothing about a screen, TTY, printer or other
devises. So you may ask in a group related to POSIX or to your OS to
get a solution beside standard C.
C does know about character display semantics (ISO 9899/1990
*and* 1999, 5.2.2), specifically backspaces ('\b'), form feeds
('\f'), and carriage returns ('\r'). So yes, it is possible to
``edit'' something already printed on a display device (however,
quality of implementation differs).
>I was just wondering if there is any way of editing anything already
>printed on the screen with out using the system("cls") command.
>
There is no "C" way to do this, as C precedes most CRT terminals,
What about ISO 9899:1990, 5.2.2, where escape sequences for
display devices (such as '\f', '\b' and '\r') are defined? The
only problem with these are quality of implementation issues.
>>Andrew Smallshaw <andrews@sdf.lo nestar.orgwrote :
>>>
>>>Most terminals, particularly modern ones, will clear the screen if
>>>you simply send them a formfeed. It's not guaranteed, but it's a
>>>
>>you're confused. Whether you've observed a particular terminal driver,
>>or a user application is probably irrelevant.
> I don't think Andrew is confused. I think you are.
hmm. I have a list in mind. Which "modern" one clears the screen
when you send a form-feed to it?
It occurs to me that you don't know
(googling to get a sense of your background makes that apparent).
A quick check shows putty doing this. vt100/etc don't. putty, of course,
is not a vt100 emulator (or xterm, etc). xterm and anything that emulates
vt100 will simply move the cursor to the next line.
There's some useful information on vt100.net which you might read before
wasting more bandwidth.
Comment