异步Windows控制台输入,同时输出

编程入门 行业动态 更新时间:2024-10-03 21:20:48
本文介绍了异步Windows控制台输入,同时输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

长时间阅读,第一次海报:D

Long time reader, first time poster :D

我在尝试读取输入同时输出时遇到问题。我需要一个服务器控制台为我的游戏,可以接收输入,而不是搞乱缓冲区。

I'm having issues trying to read input whilst outputting at the same time. I need a server console for my game which can receive input whilst outputting and not mess up the buffer.

例如,我在输入Hello world过程,玩家死亡,杀死等输出到控制台,这将导致类似:

For example, I'm typing "Hello world" and in the process, player deaths, kills, etc. are being outputted into the console, which would result in something like:

* world

Hello *Player killed Player2*world

提前感谢

推荐答案

而不是直接写输出到控制台,为什么不产生一个GUI窗口?

Instead of writing output directly to the console, why not spawn a GUI window?

然后,只有一个区域输出指向,在底部,您可以在其中键入命令。 Kinda喜欢irc客户端的外观。

Then, just have one area where output is directed, and a separate input area at the bottom where you can type commands. Kinda like how an irc client would look.

如果它只是控制台,我建议使用像ncurses(或PDCurses)来创建一个基于文本的界面。

If it has to be console only, I would suggest using something like ncurses (or PDCurses) to create a text based interface.

更多推荐

异步Windows控制台输入,同时输出

本文发布于:2023-11-03 04:36:17,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1554248.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:控制台   Windows

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!