以字符为单位设置控制台大小
Set console size in characters
到目前为止,我希望无论它在什么设备上运行,都能够将控制台大小设置为
完全相同static const int nScreenWidth = 80;
static const int nScreenHeight = 30;
int main()
{
system("MODE CON COLS=80 LINES=30");
}
但是由于我将宽度和高度存储在变量中,因此需要手动更改,这并不酷。 我试过了
system("MODE CON COLS=" + std::to_string(nScreenWidth).c_str() + " LINES=30");
但我得到表达式必须具有整数或无作用域枚举类型。
所有功能来自
#include <windows.h>
以像素为单位设置控制台大小,但我需要它以字符为单位。
看看这是否有帮助:
std::string str = "MODE CON COLS=" + std::to_string(nScreenWidth) + " LINES=30";
system(str.c_str());
相关文章:
- 如何将从控制台应用程序C++回调设置为C++ COM DLL
- 使用代码在 AWS 开发工具包C++控制台应用程序上设置凭证
- 以字符为单位设置控制台大小
- 我的控制台处理程序不处理 CTRL+C,即使设置正确
- 通过行和列设置控制台屏幕尺寸和屏幕缓冲区
- 我如何将编程控制台字体设置为Lucida
- 如何在 Windows 中将 C/C++ 控制台文本设置为粗体和斜体
- C++:如何为控制台应用程序设置新的 wndProc
- 如何在Visual Studio中设置输出控制台宽度
- 如何在控制台Win32应用程序中设置计时器
- LLDB:通过控制台为malloc_error_break设置断点
- 无法在Boost.log中设置控制台日志的格式
- 在全屏模式下设置控制台字体大小
- 将盈透证券C++API设置为控制台应用程序
- 设置控制台信息窗口大小调整不起作用 c++
- 如何在Win32控制台应用程序中将argv[]设置为不区分大小写
- 如何以编程方式将控制台字体设置为“光栅字体”
- 如何为标准输出设置控制台光标位置
- 在开发人员C++中将控制台设置为最大化
- 在多个监视器上设置控制台窗口信息