One*_*ree 3 c++ macos console-application
我有这段可以在Windows上完美运行的c ++代码,但是我试图将其移植到OSX并遇到很多编译错误。
OSX是否有一个等效的库?
#include <windows.h>
void gotoXY(int x, int y)
{
//Set the coordinates
COORD coord = {x, y};
//Set the position
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
return;
}
Run Code Online (Sandbox Code Playgroud)
使用nCurses库(推荐),或使用ANSI转义序列:
// nCurses, you need to initialize the window before
move(x, y);
Run Code Online (Sandbox Code Playgroud)
// ANSI escape seq
printf("\033[%d;%dm", x, y);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
547 次 |
| 最近记录: |