how to set cursor position?

This is a discussion on how to set cursor position? within the C Programming forums, part of the General Programming Boards category; without using curses.h how do u set cursor location??...

  1. #1
    Registered User
    Join Date
    Feb 2003
    Posts
    2

    how to set cursor position?

    without using curses.h
    how do u set cursor location??

  2. #2
    Casual Visitor
    Join Date
    Oct 2001
    Posts
    350
    Originally posted by vVv
    See if

    Code:
    #include <stdio.h>
    
    int x = 5,
        y = 10;
    printf( "\033[%d;%df", y, x );
    puts( "hello" );
    works for your terminal.
    I *think* that ansi.sys has be loaded before using escape sequences... in dos anyway.

    wtam, search this board as I *know* that I saw a windoze solution posted not too long ago. If you're using a dos compiler, then you would have access to gotoxy in Borland and _settextposition in MS.

    I have no idea using other operating systems or compilers.
    I haven't used a compiler in ages, so please be gentle as I try to reacclimate myself. :P

  3. #3
    Registered User
    Join Date
    Feb 2003
    Posts
    5

    Thumbs up

    curser position
    ===========



    by using gotoxy() function we can place the curser in required place.


    syntax :
    ==========
    gotoxy(col,row);

    or it can be done by 2 for loops
    ======================
    for(i=1;i<=row;i++)
    printf("\n");
    for(i=1;i<=col;i++)
    printf(" ");





  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    >>His curses-remark suggests he's using a Unix-like operating system
    Err... no, he implies he doesn't have curses.h, so maybe it isn't *nix. Either way, a pointless conversation until the OP gives the proper information.
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Registered User
    Join Date
    Feb 2003
    Posts
    2
    i m using unix, so escape sequence works
    thank you

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by wtam
    i m using unix, so escape sequence works
    thank you
    From Salem's earlier post: be specific about which OS and compiler you have
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 8
    Last Post: 01-18-2008, 03:06 AM
  2. The new FAQ
    By Hammer in forum A Brief History of Cprogramming.com
    Replies: 34
    Last Post: 08-30-2006, 10:05 AM
  3. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  4. Menu Item Caption - /a for right aligned Accelerator?
    By JasonD in forum Windows Programming
    Replies: 6
    Last Post: 06-25-2003, 11:14 AM
  5. Set default directory with GetTempDir?
    By Bajanine in forum Windows Programming
    Replies: 2
    Last Post: 05-04-2003, 11:36 PM

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