473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

screen clearing in ANSI C

Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu
Nov 24 '06 #1
65 8516
Leslie Kis-Adam wrote:
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
No, "screens" are platform specific and may not even exist in many.

--
Ian Collins.
Nov 24 '06 #2

Leslie Kis-Adam wrote:
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu
printf(" \033[2J");

should do the work, it's an ansi code for clear screen

Nov 24 '06 #3
st******@gmail.com said:
>
Leslie Kis-Adam wrote:
>Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu

printf(" \033[2J");

should do the work, it's an ansi code for clear screen
I wrapped it up in a main and ran it on my Linux box, but the screen didn't
clear. Not even the terminal window cleared.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 24 '06 #4
If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
..
..
..
system("cls");
..
..
..
}

This syntax is what I have been using over the years, however, you have
to find the proper spot to place this syntax.

kind regards,
Gurdip Singh.
gu****@hackinthebox.org || gu*************@gmail.com

Nov 24 '06 #5
gurdz wrote:
If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
system("cls");
Platform (windows?) specific.

--
Ian Collins.
Nov 24 '06 #6
In article <11**********************@m7g2000cwm.googlegroups. com>,
gurdz <gu*************@gmail.comwrote:
>If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
>system("cls");
I tried that, but unfortunately the "cls" command on my system means
"clear local storage", and it reformatted all my disks.

-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
Nov 24 '06 #7
"Leslie Kis-Adam" writes:
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
A for loop containing about 60 '\n's would clear most, but not all,
screens.
Nov 24 '06 #8
gurdz wrote:
If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
..
..
..
system("cls");
..
..
..
}

This syntax is what I have been using over the years, however, you have
to find the proper spot to place this syntax.
Hmm, when I run the following program, it outputs:
"sh: line 1: cls: command not found"

#include <stdlib.h>

int main()
{
system("cls");
return 0;
}
--
Clark S. Cox III
cl*******@gmail.com
Nov 25 '06 #9
>Hi everyone!
>Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Where is the screen on my ASR33 teletype? Or do you mean the metal
screen that keeps flies from getting sucked into the fan on the back of
the CPU unit? For that one, you power down the CPU, remove the screen,
and blast it with a stream of water from a hose to wash the flies off.
Nov 25 '06 #10
On Sat, 25 Nov 2006 11:43:57 +1300, Ian Collins <ia******@hotmail.com>
wrote:
>Leslie Kis-Adam wrote:
>Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?

No, "screens" are platform specific and may not even exist in many.
It simply can't be done in ANSI C. The most portable and reliable
method is to remove power.

--
Dan Henry
Nov 25 '06 #11
Leslie Kis-Adam wrote:
>
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Yes, I know. No, it isn't.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Nov 25 '06 #12
st******@gmail.com wrote:
Leslie Kis-Adam wrote:
>Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?

printf(" \033[2J");

should do the work, it's an ansi code for clear screen
Doesn't work on my ASR33 teletype.

--
Chuck F (cbfalconer at maineline dot net)
Available for consulting/temporary embedded and systems.
<http://cbfalconer.home.att.net>
Nov 25 '06 #13
system ("cls") works for me....

i will provide you with a simple program that uses it when i get back
on.. right now i gotta head for classes..thats right. classes on
saturday...

kind regards,
Gurdip

Nov 25 '06 #14
gurdz wrote:
system ("cls") works for me....

i will provide you with a simple program that uses it when i get back
on.. right now i gotta head for classes..thats right. classes on
saturday...
You should provide some context when replying. This is not Google
Groups. This is Usenet.

The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
Nov 25 '06 #15
Then your Lunix doesn't support ANSI escape codes

http://en.wikipedia.org/wiki/ANSI_escape_code

Richard Heathfield wrote:
st******@gmail.com said:

Leslie Kis-Adam wrote:
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu
printf(" \033[2J");

should do the work, it's an ansi code for clear screen

I wrapped it up in a main and ran it on my Linux box, but the screen didn't
clear. Not even the terminal window cleared.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 25 '06 #16
[Top-posting fixed]

st******@gmail.com said:
Richard Heathfield wrote:
>st******@gmail.com said:
Leslie Kis-Adam wrote:
Does anyone know, if it is possible to clear the screen in ANSI C?

printf(" \033[2J");

should do the work, it's an ansi code for clear screen

I wrapped it up in a main and ran it on my Linux box, but the screen
didn't clear. Not even the terminal window cleared.
Then your Lunix
Linux
doesn't support ANSI escape codes
Actually, it does, so that wasn't the problem. There was something *else*
you didn't take into account. But yes, that *might* have been the problem,
mightn't it? So that's at least two problems with your suggested technique,
and I humbly suggest that your suggested technique is therefore not
adequate to the task.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 25 '06 #17
Ian Collins said:
gurdz wrote:
>If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
system("cls");

Platform (windows?) specific.
Works fine in MS-DOS, too (unless you've hacked COMMAND.COM, of course). But
yes.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 25 '06 #18
osmium said:
"Leslie Kis-Adam" writes:
>Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?

A for loop containing about 60 '\n's would clear most, but not all,
screens.
For example, it wouldn't clear anything off a non-scrolling terminal. It
wouldn't clear anything off a teletype. It wouldn't clear anything off a
window other than the current window (on a multi-window system). It
wouldn't clear anything off a screen if stdout is not associated with that
screen (which isn't necessarily under the control of the program). In fact,
there are so many ways this won't work that I'm surprised you bother to
suggest it.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 25 '06 #19
Dan Henry said:
On Sat, 25 Nov 2006 11:43:57 +1300, Ian Collins <ia******@hotmail.com>
wrote:
>>Leslie Kis-Adam wrote:
>>Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?

No, "screens" are platform specific and may not even exist in many.

It simply can't be done in ANSI C. The most portable and reliable
method is to remove power.
Peter Seebach may well have serious objections to that suggestion (since he
claims to be a conforming implementation).

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 25 '06 #20
sq

"Leslie Kis-Adam дµÀ£º
"
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu
sorry ,I do not know~

Nov 25 '06 #21


On Nov 25, 7:04 am, "gurdz" <gurdipsgandh...@gmail.comwrote:
If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
.
.
.
system("cls");
.
.
.

}This syntax is what I have been using over the years, however, you have
to find the proper spot to place this syntax.

kind regards,
Gurdip Singh.
gur...@hackinthebox.org || gurdipsgandh...@gmail.com
I know a little about it. There seems to be no such an ANSI function to
do this kind of work.
The function "system("cls")" just calls the shell to execute that
command. So the shell command inside that function is system specific.
"cls" is probably used in MS-DOS. And therefore, "clear" is for most
UNIX/Linux like systems. It's just shell command:-)

Nov 25 '06 #22
ive been using system("cls")
works fine on my windows system but i think it wont wrk on a linux box
bcoz its a shell command for Dos!!

On Nov 25, 12:48 pm, "Becker" <weichao...@gmail.comwrote:
On Nov 25, 7:04 am, "gurdz" <gurdipsgandh...@gmail.comwrote:
If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
.
.
.
system("cls");
.
.
.
}This syntax is what I have been using over the years, however, you have
to find the proper spot to place this syntax.
kind regards,
Gurdip Singh.
gur...@hackinthebox.org || gurdipsgandh...@gmail.comI know a little about it. There seems to be no such an ANSI function to
do this kind of work.
The function "system("cls")" just calls the shell to execute that
command. So the shell command inside that function is system specific.
"cls" is probably used in MS-DOS. And therefore, "clear" is for most
UNIX/Linux like systems. It's just shell command:-)
Nov 25 '06 #23

gurdz wrote:
system ("cls") works for me....
Good for you. What's that got to do with the question?

Nov 25 '06 #24
"Richard Tobin" <ri*****@cogsci.ed.ac.ukwrote in message
news:ek**********@pc-news.cogsci.ed.ac.uk...
In article <11**********************@m7g2000cwm.googlegroups. com>,
gurdz <gu*************@gmail.comwrote:
>>If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
>>system("cls");

I tried that, but unfortunately the "cls" command on my system means
"clear local storage", and it reformatted all my disks.
:O Sue him!

lol...
Nov 25 '06 #25
rhle.freak wrote:
ive been using system("cls")
You've been playing dice.
works fine on my windows system
but i think it wont wrk on a linux box
bcoz its a shell command for Dos!!
Why don't you try Linux and find out instead of silly assumptions?

Nov 25 '06 #26
gurdz wrote:
If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
{
.
.
.
system("cls");
.
.
.
}
Completely non-portable. Assumes the existence of a host system, a
command called 'cls' and that the said command clears the screen, no
more no less.
This syntax is what I have been using over the years, however, you have
to find the proper spot to place this syntax.
It's a call to a function, not a syntax.

Nov 25 '06 #27
st******@gmail.com wrote:

Your reply should ideally be in between or after the quoted text, as
otherwise, it affects the reading order for other posters.
Richard Heathfield wrote:
st******@gmail.com said:
Leslie Kis-Adam wrote:
>Hi everyone!
>Does anyone know, if it is possible to clear the screen in ANSI C?
>If it is,then how?
>Any help would be appreciated.
>>
>Laszlo Kis-Adam
><dfighter_AT-NOSPAM_freemail.hu
>
printf(" \033[2J");
>
should do the work, it's an ansi code for clear screen
I wrapped it up in a main and ran it on my Linux box, but the screen didn't
clear. Not even the terminal window cleared.

Then your Lunix doesn't support ANSI escape codes

http://en.wikipedia.org/wiki/ANSI_escape_code
Nor does standard C. Why make your program needlessly non-portable,
especially given that clearing the screen is not important to most
console programs?

Nov 25 '06 #28
santosh said:

<snip>
Why make your program needlessly non-portable,
especially given that clearing the screen is not important to most
console programs?
C isn't only useful for console programs, and clearing a screen (or, more
commonly nowadays, a window) can be a useful thing to do. It is not
unreasonable to ask whether an ISO C method exists (although of course we
know the answer is that it doesn't, and that an implementation-specific
method will need to be used).

Yes, you're right that a great many people seem to delight in clearing the
screen for no particularly good reason. But the OP *might* have a good
reason for asking - you never know your luck! - so the best thing to do, I
suppose, is simply to explain the fact that the method will vary from
system to system, so he should abstract out the non-portable functionality
into a separate function, and then write various versions of that function
on an implementation-by-implementation basis.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 25 '06 #29

"Richard Heathfield" <rj*@see.sig.invalidwrote in message
news:iL********************@bt.com...
santosh said:

<snip>
>Why make your program needlessly non-portable,
especially given that clearing the screen is not important to most
console programs?

C isn't only useful for console programs, and clearing a screen (or, more
commonly nowadays, a window) can be a useful thing to do. It is not
unreasonable to ask whether an ISO C method exists (although of course we
know the answer is that it doesn't, and that an implementation-specific
method will need to be used).

Yes, you're right that a great many people seem to delight in clearing the
screen for no particularly good reason. But the OP *might* have a good
reason for asking - you never know your luck! - so the best thing to do, I
suppose, is simply to explain the fact that the method will vary from
system to system, so he should abstract out the non-portable functionality
into a separate function, and then write various versions of that function
on an implementation-by-implementation basis.
What I need is a function that will clear my desk.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.

Nov 25 '06 #30
i dont giv a damn.i know it wont wrk ..its a shell command for dos ,not
for linux :-x!!

On Nov 25, 5:04 pm, "santosh" <santosh....@gmail.comwrote:
rhle.freak wrote:
ive been using system("cls")You've been playing dice.
works fine on my windows system
but i think it wont wrk on a linux box
bcoz its a shell command for Dos!!Why don't you try Linux and find out instead of silly assumptions?
Nov 25 '06 #31
rhle.freak wrote:
ive been using system("cls")
Please don't top-post. Your replies belong following or interspersed
with properly trimmed quotes. See the majority of other posts in the
newsgroup, or:
<http://www.caliburn.nl/topposting.html>
Nov 25 '06 #32

Nelu wrote:
gurdz wrote:
system ("cls") works for me....

i will provide you with a simple program that uses it when i get back
on.. right now i gotta head for classes..thats right. classes on
saturday...

You should provide some context when replying. This is not Google
Groups. This is Usenet.
I thought that giving context coming at usenet through google would be
hard. It is not.
The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux. LS

Nov 25 '06 #33
On 24 Nov 2006 15:04:29 -0800, in comp.lang.c , "gurdz"
<gu*************@gmail.comwrote:
>If I'm not wrong, the simplest method of clearing the screen would be
to use a syntax as shown below
.
system("cls");
-bash: cls: command not found

(note: posting system-specific responses in CLC will get you flamed).

--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Nov 25 '06 #34
On Fri, 24 Nov 2006 23:34:22 +0100, in comp.lang.c , Leslie Kis-Adam
<df******@freemail.huwrote:
>Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
You know this is a FAQ, right?
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
Nov 25 '06 #35
lane straatman wrote:
Nelu wrote:
><snip>
The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux. LS
My argument was that what he did was implementation dependent and
it was not off-topic. I hope your argument was intended as a
joke, otherwise you're just trolling and I wasted my time replying.

--
Ioan - Ciprian Tandau
tandau _at_ freeshell _dot_ org (hope it's not too late)
(... and that it still works...)
Nov 25 '06 #36
lane straatman said:
Nelu wrote:
>The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux.
Yes. It's also just another reason to steer clear of Macs, mainframes,
minicomputers, games consoles, set-top boxes, microwave ovens, and indeed
just about anything that has some kind of display screen but which doesn't
happen to run MS-DOS or Windows. Your world is tiny, but it's safe.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
Nov 26 '06 #37
"lane straatman" <gr**********@netzero.netwrote in message
>
>The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux. LS
Absolutely. Join my campaign for 64-bit ints.

One world,
One race,
One true religion
One vision.

One OS, one way of representing integers.

--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Nov 26 '06 #38

"Dan Henry" <us****@danlhenry.comwrote in message
news:ct********************************@4ax.com...
On Sat, 25 Nov 2006 11:43:57 +1300, Ian Collins <ia******@hotmail.com>
wrote:
>>Leslie Kis-Adam wrote:
>>Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?

No, "screens" are platform specific and may not even exist in many.

It simply can't be done in ANSI C. The most portable and reliable
method is to remove power.
A friend of mine wrote an adventure featuring an LCD laptop with a run-down
battery and the last inputs frozen on the screen.
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Nov 26 '06 #39
Malcolm wrote:
"lane straatman" <gr**********@netzero.netwrote in message
The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux. LS
Absolutely. Join my campaign for 64-bit ints.

One world,
One race,
One true religion
One vision.

One OS, one way of representing integers.
.... and One Standard for C.
Oops, which one?

Nov 26 '06 #40
Mark McIntyre wrote:
On Fri, 24 Nov 2006 23:34:22 +0100, in comp.lang.c , Leslie Kis-Adam
<df******@freemail.huwrote:
>Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?

You know this is a FAQ, right?
I've found it out!

--
Leslie Kis-Adam or
Laszlo Kis-Adam or even
Kis-Ádám László

Student
Budapest University of Technology and Economics
Faculty of Electronic Engineering and Computer Science
<dfighter_AT_NOSPAM_freemail.hu>
Nov 26 '06 #41
Does anyone know, if it is possible to clear the screen in ANSI C?

On platforms that have "glass teletype" screens, it is usually
possible to send the terminal a "clear screen" message without
violating any of the rules on ANSI C.
If it is,then how?
Platform-specific escape codes, usually. On other platforms there will
be a command executable with the system() function.

If you meant "is it possible to *portably* clear the screen in ANSI
C?", the answer is no.

--Joel

Nov 26 '06 #42
st******@gmail.com wrote:
Then your Lunix doesn't support ANSI escape codes
If you’re referring to lunix, then you ought to be using Ken’s C
compiler and not worrying about ANSI… ☺

--Joel

Nov 26 '06 #43
"santosh" <sa*********@gmail.comwrote in message
Malcolm wrote:
>"lane straatman" <gr**********@netzero.netwrote in message
>
The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux. LS
Absolutely. Join my campaign for 64-bit ints.

One world,
One race,
One true religion
One vision.

One OS, one way of representing integers.

... and One Standard for C.
Oops, which one?
A failed standard is a huge problem.
The only answer is to be very conservative.
However the other day I found myself needing nans to represent uninitialised
numbers in my new BASIC interpreter. So I swallowed hard and put is an
_isnan() from Microsoft. Also I wanted a vnsprintf in some config file
reading code, soon to be posted.
The question is, is it better to have a potential security hole or a
potential unsupported dependency? Or should I add lines and lines of code
checking every argument, which invilves parsing a printf format string? Or
just make the interface harder to use?
--
www.personal.leeds.ac.uk/~bgy1mm
freeware games to download.
Nov 26 '06 #44
Malcolm wrote:
"santosh" <sa*********@gmail.comwrote in message
Malcolm wrote:
"lane straatman" <gr**********@netzero.netwrote in message

The request was for ANSI C. Wanna bet that that call won't clear
the screen on my Linux machine even though it will probably
compile correctly?
Just another reason to steer clear of linux. LS

Absolutely. Join my campaign for 64-bit ints.

One world,
One race,
One true religion
One vision.

One OS, one way of representing integers.
... and One Standard for C.
Oops, which one?
A failed standard is a huge problem.
The only answer is to be very conservative.
....
The question is, is it better to have a potential security hole or a
potential unsupported dependency?
In nearly all cases the latter is better, particularly if you clearly
document the dependency. It shouldn't be too much of a problem for
users of the program to download the correct version as well as any
dependencies.
Or should I add lines and lines of code
checking every argument, which invilves parsing a printf format string? Or
just make the interface harder to use?
Your call, (and I suppose it'll vary on a case by case basis,
especially depending upon the program's target user base's skill
level), but the trend for a decade now has been to make the software
"user friendly", at the cost of the programmer and portability.

Nov 27 '06 #45
In article <11**********************@j72g2000cwa.googlegroups .com>,
st******@gmail.com writes
>Then your Lunix doesn't support ANSI escape codes

http://en.wikipedia.org/wiki/ANSI_escape_code

This is where Wiki gets dangerous. Any damned fool can write it.

Linux, Unix, Dos, windows, VMX, VAX, CPM , MPM, OS9, PSOS etc etc have
terminal windows. (Even if in the case of DOS it is only one large
terminal window)

They use terminal drivers. Two of the more common are VT100 and VT52.
However there are many others.

What is the terminal type you are trying to clear screen on?

BTW this is WAY off topic for C.L.C
>
Richard Heathfield wrote:
>st******@gmail.com said:
>
Leslie Kis-Adam wrote:
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu

printf(" \033[2J");

should do the work, it's an ansi code for clear screen

I wrapped it up in a main and ran it on my Linux box, but the screen didn't
clear. Not even the terminal window cleared.

--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999
http://www.cpax.org.uk
email: rjh at the above domain, - www.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Nov 27 '06 #46
In article <11*********************@m7g2000cwm.googlegroups.c om>,
santosh <sa*********@gmail.comwrites
>st******@gmail.com wrote:

Your reply should ideally be in between or after the quoted text, as
otherwise, it affects the reading order for other posters.
>Richard Heathfield wrote:
st******@gmail.com said:
Leslie Kis-Adam wrote:
Hi everyone!
Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?
Any help would be appreciated.

Laszlo Kis-Adam
<dfighter_AT-NOSPAM_freemail.hu

printf(" \033[2J");

should do the work, it's an ansi code for clear screen

I wrapped it up in a main and ran it on my Linux box, but the screen didn't
clear. Not even the terminal window cleared.

Then your Lunix doesn't support ANSI escape codes

http://en.wikipedia.org/wiki/ANSI_escape_code

Nor does standard C. Why make your program needlessly non-portable,
especially given that clearing the screen is not important to most
console programs?
If yopu have a screen you will need to clear it at some point. You have
to use the escape codes for that VT

What to you meed by "needlessly non-portahble? The only way o0f making
it completely portable is having no screen.

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Nov 27 '06 #47
In article <4s************@mid.individual.net>, osmium
<r1********@comcast.netwrites
>"Leslie Kis-Adam" writes:
>Does anyone know, if it is possible to clear the screen in ANSI C?
If it is,then how?

A for loop containing about 60 '\n's would clear most, but not all,
screens.
That is not a"clear screen."

--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/

Nov 27 '06 #48

santosh wrote:
Your call, (and I suppose it'll vary on a case by case basis,
especially depending upon the program's target user base's skill
level), but the trend for a decade now has been to make the software
"user friendly", at the cost of the programmer and portability.
"user friendly" went from meaning to have a powerful tool that you need
to learn to use to having a somewhat "has to work out of the box
without even understanding what it does".
I would rather say "user knowledge overriding" software.

Thomas

Nov 27 '06 #49
Malcolm wrote:
>
What I need is a function that will clear my desk.
Take the mechnism from one of those self-cleaning
kitty-litter boxes, and mount it to your desk.
It will then automatically clear your desk after
each use.

----== Posted via Newsfeeds.Com - Unlimited-Unrestricted-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 27 '06 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Curious Student | last post by:
I was looking at methods of clearing the screen. I remember using clrscr() in C on a Unix machine when I was at the institute learning software development. I tried using it on MS VC++ 6.0. It...
51
by: someone | last post by:
I was just wondering if there is any way of editing anything already printed on the screen with out using the system("cls") command.
11
by: Rajendran | last post by:
I just want to clear the above three lines from the current position, so that I can start printing my results from that point. In short I want to clear a portion of my screen. Note: I work in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.