当用作 Gotoxy() 的替代方法时,ANSI 转义序列显示不正确
conio.h 和 Gotoxy 不适用于我的 C 编译器。我尝试在网上搜索解决方案并发现以下内容:
void gotoxy(int x, int y)
{
printf("\033[%d;%dH", y, x);
}
但是,它没有按预期定位光标。它仅
←[1;10H
在我尝试将 x 和 y 分别设置为 10 和 1 时显示。我找到了其他替代方案,例如使用 SetConsolePosition,但我仍然想知道使用 ANSI 转义序列是否有效。
我目前正在使用 CodeBlocks IDE。
conio.h and gotoxy does not work with my compiler for C. I tried searching for solutions on the web and found the following:
void gotoxy(int x, int y)
{
printf("\033[%d;%dH", y, x);
}
However, it does not position the cursor as intended. It only displays
←[1;10H
when I try to set x and y to 10 and 1 respectively. I have found other alternatives like using SetConsolePosition but I would still like to know if using ANSI escape sequences would work.
I am currently using the CodeBlocks IDE.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论