Hey All!

kindly please tell me how to get user input right after the outtextxy function in graphics mode. Compiler : Turbo C , Win XP

here is my program:

#include<stdio.h>
#include<conio.h>
#include<graphics.h>

void main()
{
int gd=detect,gm,s;
initgraph(&gd,&gm,"c:\\tc\\bgi");
cleardevice();
outtextxy(100,120,"enter number here : ");
scanf("%d",&s);
getch();
}

now here what i want is the cursor to be displayed right after where "Enter number here" gets printed and takes the user input there.. but scanf is getting the input on top left corner.. kindly tell me if there is any replacement for scanf in graphics mode or anything else... thanks

Move the cursor with gotoxy() . Just because you output text at a certain location doesn't mean the cursor was moved.

up

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.