Cursor Positioning

This is a discussion on Cursor Positioning within the Linux Programming forums, part of the Platform Specific Boards category; In QBasic you could write: locate 5, 5 print "Hello" And it would print the string wherever you wanted onto ...

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    17

    Question Cursor Positioning

    In QBasic you could write:

    locate 5, 5
    print "Hello"

    And it would print the string wherever you wanted onto the console. What function does this in c++ and in what header file? I'm using RHLinux 7.2 with gcc-c++ > 2.96

    Thanks,
    rdnjr
    -----------------------
    R. D. Nichols, Jr.

    -Why do I have to go EVERYWHERE in this handbasket?

  2. #2
    Registered User Hoxu's Avatar
    Join Date
    Nov 2001
    Posts
    25
    Code:
    gotoxy(5,5);
    printf("Hello");
    that's the code if you are using msdos.. if you want to do same with linux you have to you ansi codes..

  3. #3
    Registered User Hoxu's Avatar
    Join Date
    Nov 2001
    Posts
    25

    Re: Cursor Positioning

    Originally posted by rdnjr
    I'm using RHLinux 7.2 with gcc-c++ > 2.96
    Oops.. didn't read that =P

    Try

    Code:
    printf("\e[5;5HHello");
    This is quite tricky.. "\e" is escape (press twice, then you should see "^[").. I recommend making own function for it =)

    For other ansi codes, check this url: http://www.viking.delmar.edu/Courses...5L/ANSIsys.htm

Popular pages Recent additions subscribe to a feed

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21