1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cursor not appearing at right spot

Discussion in 'C' started by mj1709, Dec 24, 2011.

  1. mj1709

    mj1709 New Member

    Joined:
    Dec 16, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    after the first time the function is executed........if it is reexecuted then the cursor wont show at the right spot.............???????:crazy::confused::undecided:(
     
  2. mj1709

    mj1709 New Member

    Joined:
    Dec 16, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    heres the code
    Code:
     
    #include<dos.h>
    #include<conio.h>
    #include<stdio.h>
    #include<stdlib.h>
    void write2screen(int y,int x,char c,int attb);
    main()
    {
    FILE *ptr; char a[12];
    int i,j;
    for(i=2;i<=49;i++)
    {
    	for(j=2;j<=79;j++)
    	{
    	write2screen(i,j,' ',0);
    	}
    }
    
    ptr=fopen("C:\\new.txt","w");
    fprintf(ptr,"hello");
    getch();
    textattr(18);
    gotoxy(10,10);
    cprintf("Hello");
    gets(a);
    getch();
    puts(a);
    getch();
    }
     
  3. mj1709

    mj1709 New Member

    Joined:
    Dec 16, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    after first esecution of the program the cursor wont show up alongwith the letters being typed in......
     
  4. mj1709

    mj1709 New Member

    Joined:
    Dec 16, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    sumbody help plese............ :(
     
  5. ewaldhorn

    ewaldhorn New Member

    Joined:
    Feb 16, 2010
    Messages:
    36
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    Cape Town, South Africa
    Home Page:
    Hi.

    What compiler are you using and on which platform?

    Conio is Windows specific if I remember correctly? If you can tell me what compiler you are using, I could try to recreate the scenario.
     
  6. mj1709

    mj1709 New Member

    Joined:
    Dec 16, 2011
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    0
    well i am using Windows XP Professional OS with Borland Compiler version 3.0...... :)
     
  7. ewaldhorn

    ewaldhorn New Member

    Joined:
    Feb 16, 2010
    Messages:
    36
    Likes Received:
    5
    Trophy Points:
    0
    Occupation:
    Developer
    Location:
    Cape Town, South Africa
    Home Page:
    Aaaah, Borland Compiler 3.0?

    Wow, that takes me back quite a bit. I'm not sure if it works as expected under Windows XP, but have you tried running in full-screen mode? On the command prompt, press Alt-Enter to go into fullscreen mode and retest your application.

    I do know that conio.h is not a standard C++ library, and it's given me lots of problems before, so the real issue might be in how that library functions. Can't you use a more modern compiler, for example, the MingW that ships with the http://www.codelite.org/ IDE?
     

Share This Page