|
-
Apr 30th, 2002, 08:59 AM
#1
Thread Starter
Lively Member
some questions
it's all under DOS:
1. how to clear the screen?
2. how to print something on the screen at a certain position?
3. how to print text with a different fore or backcolor?
VIsualPenguin
Last edited by VIsualPenguin; Apr 30th, 2002 at 10:23 AM.
-
Apr 30th, 2002, 11:02 AM
#2
You have to printf ANSI.SYS compliant escape sequences
Basically the sequnces are escape (ascii 27) [ (ascii 91)
followed by sequences of letters and numbers. When you send a number it has to be a single character, and the ascii value
For example if you want to send a 1 then
Code:
char s,esc,squacket; // squacket is a square bracket
s = '1';
esc = 27;
squacket = 91;
printf("%c%c%c",esc,squacket,s);
The two sequcnes I know offf the top of my head
clear screen = esc[2J
move cursor to a given position (ex: row=2, col =4 ) esc[2;4H
Go here for a description:
http://enterprise.aacc.cc.md.us/~rhs/ansi.html
-
May 1st, 2002, 03:04 AM
#3
Addicted Member
1. use system("cls");
2. don't really know
3. See your MSDN, I think you can use SetConsoleTextAttribute
-
May 1st, 2002, 08:49 AM
#4
Thread Starter
Lively Member
it's in Real DOS, not in a console.
VIP
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
|