在我使用“ \ 33 [2J \ 33 [很多次?
我正在为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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论