c++ clear screen
|
Original Message
|
Name: eaw8806
Date: August 28, 2003 at 18:48:29 Pacific
Subject: c++ clear screen OS: win98 CPU/Ram: pentiumII/128MB
|
Comment: have been trying to learn c++ a little bit, trying to make tic-tac-toe and simple programs like that...well anyways, how would you clear the output screen, and put the output at the top. in other words, is there a c++ equivilent to the LOCATE x,y in qbasic? thanks for any help. -eaw8806
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: Infinite Recursion
Date: August 28, 2003 at 19:02:34 Pacific
Subject: c++ clear screen |
Reply: (edit)I'm not sure about the equivalent of the LOCATE x,y... there is probably something in graphics.h or windows.h to handle that... but to clear the screen to be at 0,0 you can make a system call as follows. system("cls"); Infinite Recursion
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: Fozzie
Date: August 28, 2003 at 21:15:57 Pacific
Subject: c++ clear screen |
Reply: (edit)You can use gotoxy(1st value, 2nd value); where you enter numbers for the 1st and 2nd values or use variables in thier places. You have to include the conio.h header. conio.h also supports the clrscr() statement which of course clears the screen.
Report Offensive Follow Up For Removal
|
|
Response Number 3
|
Name: zeroguy
Date: August 29, 2003 at 09:49:02 Pacific
Subject: c++ clear screen
|
Reply: (edit)I think conio.h is your best bet, but you have to make sure you have a compiler that supports it. conio.h is not standard C++ (it's a Borland extension), so not all compilers support it. Turbo C++ obviously does, but I'm not sure about MVC++. Dev-C++ sort of supports it, but it doesn't always behave appropriately.
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: