简体   繁体   English

c++ 使用 ansi 获取终端尺寸

[英]c++ get terminal size using ansi

I'm trying to get the terminal size using ansi escape codes.我正在尝试使用 ansi 转义码获取终端大小。 I found some help in How do I determine size of ANSI terminal?我在如何确定 ANSI 终端的大小? but i cannot understand how to get the response from DSR6 to get the row / column of the bottom right corner.但我不明白如何从 DSR6 获得响应以获取右下角的行/列。 Thank you.谢谢你。 I need this because im trying to align some text in the middle of the terminal.我需要这个,因为我试图在终端中间对齐一些文本。

I don't have a solution using ansi escape codes, but this solution here gives you the terminal size in both Windows and Linux: https://stackoverflow.com/a/62485211/9178992我没有使用 ansi 转义码的解决方案,但这里的解决方案为您提供了 Windows 和 Linux 中的终端大小: Z5E056C500A1C4B6A7110B50D807BADE925Z://stackoverflow.com/7

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM