|
-
Feb 18th, 2001, 01:59 AM
#1
Thread Starter
Fanatic Member
i'm writing an ansi c program. how do you clear the text from the screen? (i'm brand new to c and c++)
-
Feb 18th, 2001, 03:20 AM
#2
Code:
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("Text");
system("cls");
printf("More text");
return 0;
}
-
Feb 20th, 2001, 09:59 PM
#3
Lively Member
You can try this code and see:
[quote]
#include<stdio.h>
int main() {
int i;
printf("Old Page");
for(i = 0; i < 80; i++)
printf("\n");
printf("New Page!");
return 0;
}
-
Feb 21st, 2001, 03:36 PM
#4
that's just adding 80 new lines. It's easier to use the system() function.
-
Feb 21st, 2001, 03:41 PM
#5
Monday Morning Lunatic
Yep -- and you can't guarantee the display size.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 21st, 2001, 11:24 PM
#6
Hyperactive Member
How do you do that?
Hi, Sorry Parksie this is off topic but how do you get
Mike "parksie" Parks to be color gradient?
Thanks.
===========================
Kourosh Gonabadi
VB Programmer 
C++ Newbie 
Graphic Designer
===========================
-
Feb 21st, 2001, 11:28 PM
#7
PowerPoster
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Feb 21st, 2001, 11:40 PM
#8
Frenzied Member
I take it screen clearing is platform dependant?
Harry.
"From one thing, know ten thousand things."
-
Feb 21st, 2001, 11:46 PM
#9
Lively Member
Yes that's why I use "\n"to create my own clear screen function. You will be able to use it regardless of platform.
-
Feb 21st, 2001, 11:56 PM
#10
Frenzied Member
True, but other platforms allow you to view different numbers of lines, so you can't be sure how many lines are visible.
Harry.
"From one thing, know ten thousand things."
-
Feb 22nd, 2001, 12:14 AM
#11
PowerPoster
well, there is always a limit to how many lines can fit on a screen, i doubt and would have more than 150. So if you were really parinoied you could do it for like 500 lines.
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
USAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSAUSA
-
Feb 22nd, 2001, 12:36 AM
#12
Frenzied Member
Hmmm well I don't know about 'always'... different platforms can allow for you to view a lot of lines. I'm sure you could add some platform-specific code to find out how many lines you needed, but then you might as well use the platform specific clear function.
Harry.
"From one thing, know ten thousand things."
-
Feb 22nd, 2001, 06:24 AM
#13
Monday Morning Lunatic
Re: How do you do that?
Originally posted by kourosh
Hi, Sorry Parksie this is off topic but how do you get
Mike "parksie" Parks to be color gradient?
Both me and Active simultaneously wrote gradient programs -- he went for two-point while I did rainbow, so different people used that. I couldn't be bothered to do any more on mine so he put rainbow into his
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Feb 23rd, 2001, 04:30 AM
#14
Thread Starter
Fanatic Member
thanks for the help. I thought there would be a supplied CLS function or at least a \ command to do it.
-
Feb 27th, 2001, 01:57 AM
#15
Are you programming for dos or just for a console?
-
Mar 1st, 2001, 01:25 AM
#16
Thread Starter
Fanatic Member
console. However, i'm doing it through vb. I thought there might be a string you could send to stdout to clear the screen, and since most console-mode apps are written in c/c++ i though i'd have better luck asking here.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|