positioning the cursor(plz help)

This is a discussion on positioning the cursor(plz help) within the C Programming forums, part of the General Programming Boards category; Well i m new to hardware programming in C. I tried to position the curser at the required position but ...

  1. #1
    the c-dil
    Join Date
    Jun 2005
    Posts
    12

    positioning the cursor(plz help)

    Well i m new to hardware programming in C. I tried to position
    the curser at the required position but i m not confident about
    this. The problem seems to be with video pages !!!!

    Code:
     include <stdio.h>
    #include <conio.h>
    #include <dos.h>
    #include<stdlib.h>
    
    
    
     void movetoxy()
     {
     
       union REGS inregs,outregs;
       inregs.h.ah=2;
       //fflush(stdin);
       //fflush(stdout);
        printf("\n Enter the row number");
        scanf("%d",&(inregs.h.dh));
        printf("\n Enter the coloumn number");
        scanf("%d",&(inregs.h.dl));
         
    
       /* i tried to make the following field 1,2 or comment it but of  
         no  use*/
          inregs.h.bh = 0;  //set the video page 
        int86(16,&inregs,&inregs);
    } 
    
     int main(void)
     {
       clrscr();
       movetoxy();
       printf("Hello");
       return 0;
     }
    Rajat kochhar

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    What operating system?
    What compiler are you using?
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >What operating system?
    Probably Windows XP.

    >What compiler are you using?
    It looks like some version of Turbo C or C++.

    >movetoxy();
    Have you tried checking your compiler's documentation to see if it supports gotoxy()?
    My best code is written with the delete key.

  4. #4
    the c-dil
    Join Date
    Jun 2005
    Posts
    12

    positioning the cursor(plz help)

    I am using windows XP and turbo c++ 3.0.
    it supports gotoxy().

    but i want to invoke ROM-BIOS function int86.
    Rajat kochhar

  5. #5
    ---
    Join Date
    May 2004
    Posts
    1,379
    Hey rajatkochhar, good luck with that. I sure hope you get it to work some day!

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >I am using windows XP and turbo c++ 3.0.
    Now, you see, I was joking about Windows XP, with a glimmer of hope that you were actually using an operating system that matched your dinosaur of a compiler.

    Repeat after me: "I <state your name> will not try to use a 16-bit real-mode compiler designed for DOS on a 'state of the art' 32-bit protected-mode operating system. I <state your name again> realize that such an action is stupid in the extreme and I don't want to be associated with the dozen a day idiots who show up on Cprog with a compiler and operating system that were released decades apart".
    My best code is written with the delete key.

  7. #7
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    Try this

    Code:
    	union REGS regs;
    	regs.h.ah=0x02;		//video function 2 to move cursor
    	regs.h.bh=0x00;		//video screen 
    	regs.h.dh=col;		//cursors column position
    	regs.h.dl=row;		//cursors row position
    	int86(0x10,&regs,&regs);

    The compiler you are using is really old .. I suggest you start using something new..

  8. #8
    the c-dil
    Join Date
    Jun 2005
    Posts
    12
    Thanx u all for your suggestions.
    suggest some new C compiler ...... borland,miracle,lcc win32,Dev-C++
    Rajat kochhar

  9. #9
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    I use gcc on linux.. and dev-c++ which comes with a gcc port on windows

  10. #10
    Jez
    Jez is offline
    The C-er
    Join Date
    Mar 2004
    Posts
    192
    I used to use LCC win32 , it has some nice features, and compilation is very fast. I got sick of all the bugs though. Now I use dev c++ like many others on this forum.

  11. #11
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    Repeat after me: "I <state your name> will not try to use a 16-bit real-mode compiler designed for DOS on a 'state of the art' 32-bit protected-mode operating system. I <state your name again> realize that such an action is stupid in the extreme and I don't want to be associated with the dozen a day idiots who show up on Cprog with a compiler and operating system that were released decades apart".
    Code:
    class PureClass{};
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  12. #12
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    Quote Originally Posted by Stoned_Coder
    Code:
    class PureClass{};
    That's a little extreme, I think. But if it makes you feel better then who am I to say otherwise?
    My best code is written with the delete key.

  13. #13
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,048
    Not miracle.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble in positioning myself into OOP way...!
    By patil.vishwa in forum C++ Programming
    Replies: 4
    Last Post: 09-19-2008, 07:19 AM
  2. Positioning in a circular pattern?
    By arcaine01 in forum C# Programming
    Replies: 1
    Last Post: 05-01-2008, 01:26 AM
  3. Positioning Message Box MFC
    By UnclePunker in forum Windows Programming
    Replies: 2
    Last Post: 08-12-2004, 05:14 AM
  4. AI and positioning?
    By SyntaxBubble in forum Game Programming
    Replies: 2
    Last Post: 02-18-2002, 01:00 PM
  5. Status bar and toolbar positioning
    By SMurf in forum Windows Programming
    Replies: 3
    Last Post: 09-30-2001, 06:18 PM

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