Replace getch (), gotoxy (), delay (), clrscr ()

I have some old source code for a program that I wrote for the Turbo C compiler. I made changes to them and want to recompile them in new compilers for Linux and Windows. So please tell me what are the BEST alternative features

getch (), delay () / sleep (), clrscr (), GotoXY ()

for C and C ++.

+5
source share
3 answers

Take a look at the ncurses library for Unix-compatible systems.

+15
source

For Windows systems:

It is best to compile the program as a console application for windows.

Windows API . MSDN: Windows

:

  • getch(): _getch() conio.h
  • delay()/sleep(): Sleep() Windows
  • clrscr(): clrscr() FillConsoleOutputCharacter() FillConsoleOutputAttribute()
  • gotoxy(): SetConsoleCursorPosition()
+7

Unix- escape- VT100 clrscr() gotoxy(). clrscr():

std::cout << "\033[2J" << std::flush;

http://www.termsys.demon.co.uk/vtansi.htm gotoxy() ..

+2

All Articles