By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,434 Members | 1,878 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,434 IT Pros & Developers. It's quick & easy.

cursor position

P: 2
the following is code.
when we get input the input should be within a squire briket.
how can the the cursor be blinking within squire briket [ ]
if any one have some idea please help me!

#include<iostream.h>
#include<conio.h>
#include<process.h>
int main()
{
clrscr();
int op;
cout<<"Your option---------------> [";
cin>>op;
cout<<"]";
getch();
return 0;

}
Nov 13 '08 #1
Share this Question
Share on Google+
6 Replies


100+
P: 256
it might be overkill for what you need but you might want to look into ncurses - its a package that gives you lots of control over the terminal window.

http://www.gnu.org/software/ncurses/
http://en.wikipedia.org/wiki/Ncurses
http://web.cs.mun.ca/~rod/ncurses/ncurses.html

I'm sure there's more than one way to accomplish your goal - mabye conio has something but I don't know because I never program in windows/dos environments.
Nov 13 '08 #2

100+
P: 687
Borland c?
There must be something with XY in its name in conio.h, mentioned in builtin help.
Nov 13 '08 #3

weaknessforcats
Expert Mod 5K+
P: 9,197
Maybe gotoxy? conio.h is non-standard so don't hold be to this.

Also, you should be using <iostream> and not <iostream.h>. iostream.h is pre-ANSI C++ and it went obsolete in 1998.
Nov 13 '08 #4

boxfish
Expert 100+
P: 469
Try printing the backspace character, \b.
Hope this helps.
Nov 13 '08 #5

100+
P: 687
Maybe gotoxy? conio.h is non-standard so don't hold be to this.
No, gotoxy is to set cursor coords, not to get them.
Ok, i managed to look in the help - they are wherex/wherey.

Also, you should be using <iostream> and not <iostream.h>. iostream.h is pre-ANSI C++ and it went obsolete in 1998.
He can't use because it will not compile then. Consider it as a legacy support project, where you can't use latest and greatest stuff despite how it is standard compliant.
Nov 13 '08 #6

boxfish
Expert 100+
P: 469
Just print "[ ]\b\b" and the cursor will be in between the two brackets.
Nov 13 '08 #7

Post your reply

Sign in to post your reply or Sign up for a free account.