使用boost ::支持ASIO :: async_read:标准输入? [英] Using boost::asio::async_read with stdin?

查看:354
本文介绍了使用boost ::支持ASIO :: async_read:标准输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

短的问题:我有运行为底色的过程,并与管道调用pogramm连接的实时仿真。我想送命令使用标准输入来获取通过标准输出从它的某些信息的过程。现在,因为它是一个实时处理,它必须是一个非阻塞输入。为提高:: ASIO :: async_read结合的iostream :: CIN这个任务是一个好主意?我将如何使用该功能,如果它是可行的?任何建议?

short question: I have a realtime-simulation which is running as a backround process and is connected with pipes to the calling pogramm. I want to send commands to that process using stdin to get certain information from it via stdout. Now because it is a real-time process, it has to be a non blocking input. Is boost::asio::async_read in conjunction with iostream::cin a good idea for this task? how would I use that function if it is feasible? Any more suggestions?

推荐答案

看看的boost ::支持ASIO :: POSIX :: stream_descriptor

<一个href=\"http://www.boost.org/doc/libs/release/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp\" rel=\"nofollow\">http://www.boost.org/doc/libs/release/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp

这篇关于使用boost ::支持ASIO :: async_read:标准输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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