如何在控制台中获得我的进程绑定到的行字符数
how to get number of characters in line in console that my process is bind to?
转述我的问题:用字符来表示控制台的宽度。
这个在windows中默认设置为80,但是用户可以改变它,如何获得这个值?
可以使用GetConsoleScreenBufferInfo
函数
CONSOLE_SCREEN_BUFFER_INFO csbi;
if(!GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &csbi))
{
// an error occourred
cerr<<"Cannot determine console size."<<endl;
}
else
{
cout<<"The console is "<<csbi.srWindow.Right-csbi.srWindow.Left<<" wide."<<endl;
}
相关文章:
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- 在基于范围的for循环中使用结构化绑定声明
- 使用 LuaBridge 将 LuaJIT 绑定到C++会导致"PANIC: unprotected error"
- 尝试通过OCI例程从Oracle获取blob数据,但出现错误:ORA-01008:并非所有变量都绑定
- 在使用GPU支持编译Tensorflow时,会遇到CUDA_TOOLKIT_PATH未绑定变量
- 视觉studo 2019中的漫画和静态/动态绑定
- 将自由函数绑定为类成员函数
- 将常量指针引用绑定到非常量指针
- 在派生类中绑定非静态模板化成员函数
- 绑定派生类方法C++从实例范围之外的分隔 std::function 变量调用
- 在 openGL 中多次绑定缓冲区
- 定义有趣的宏和正则表达式在Z3 C++绑定
- 使用结构化绑定'Reflection'
- 为什么 std::绑定错误参数可以成功?
- 如何绑定 C++ gRPC 客户端的网络接口
- 在 openmp 中,omp_get_thread_num是否绑定到物理线程?
- C++绑定(已弃用)
- 为什么静态常量字符 * const 变量在为左值时可绑定到右值引用参数
- 字符串文字绑定到一个非常量字符指针
- 如何在控制台中获得我的进程绑定到的行字符数