Results 1 to 4 of 4

Thread: some questions

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115

    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.
    ICQ :137108715
    MSN Messenger : [email protected]

  2. #2
    jim mcnamara
    Guest
    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

  3. #3
    Addicted Member
    Join Date
    Aug 2001
    Location
    I'm mobile
    Posts
    166
    1. use system("cls");
    2. don't really know
    3. See your MSDN, I think you can use SetConsoleTextAttribute
    [p r a e t o r i a n]

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    Netherlands
    Posts
    115
    it's in Real DOS, not in a console.

    VIP
    ICQ :137108715
    MSN Messenger : [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width