在我使用“ \ 33 [2J \ 33 [很多次?

发布于 2025-02-13 22:10:52 字数 755 浏览 0 评论 0原文

我正在为Windows编写一款终端游戏,刷新很慢,所以我问 此处 寻求帮助。

std::cout << "\33[2J\33[H"; // They told me to write this...
system("cls") // ...instead of this

但是,发送ASCII逃生序列只会使端子“ scroll” ,而无需删除任何内容。


可以说我真的想删除旧框架:我应该怎么做?


为了举一个例子,他们告诉我...

std::cout << '\n'; // This...
std::cout << std::endl; // ...was faster than this

然后我问\ n缺少什么等于std :: endl,他们告诉我<代码> std :: flush 。

因此,我的问题是: \ 33 [2J \ 33 [H等同于System(“ Cls”)

I'm writing a terminal game for Windows, and the refresh was quite slow so I asked here for help.

std::cout << "\33[2J\33[H"; // They told me to write this...
system("cls") // ...instead of this

But sending that ASCII escape sequence just makes the terminal "scroll", without deleting anything.


Lets say I really want to delete the old frames sometimes: how should I do it?


Just to make an example, they told me that...

std::cout << '\n'; // This...
std::cout << std::endl; // ...was faster than this

Then I asked what was missing to \n to become equivalent to std::endl, and they told me std::flush.

So my question is: what is missing to \33[2J\33[H to be equivalent to system("cls")?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文