当输出比控制台宽时,如何防止自动换行? [英] How to prevent automatic newlines, when the output is wider than the console?

查看:76
本文介绍了当输出比控制台宽时,如何防止自动换行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用控制台输出来实现生活游戏.到目前为止看起来不错:

I'm implementing the game of life, using console output. So far it's looking good:

但是,当我使输出的宽度大于控制台的宽度时,会发生这种情况:

However, when I make the width of the output larger than the with of the console, this happens:

它不会插入行,而是插入换行符.有没有办法关闭此功能?

Instead of letting the lines run offscreen, it inserts a newline. Is there a way to turn this off?

我正在使用一台小型笔记本电脑,因此请更改

I'm on a small laptop, so changing the console width doesn't really help.

推荐答案

我认为您必须获取并设置屏幕的最大长度.

I think you have to get and set the maximum length of the screen.

因此您会获得长度.

如果需要更多空间,可以 BufferSize

If you need more space you can set the windows size :) Dont forget to set the BufferSize too

这篇关于当输出比控制台宽时,如何防止自动换行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆