Using boost::asio::async_read with stdin?

二次信任 提交于 2019-11-27 05:54:08

问题


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?


回答1:


Look at boost::asio::posix::stream_descriptor

http://www.boost.org/doc/libs/release/doc/html/boost_asio/example/cpp03/chat/posix_chat_client.cpp



来源:https://stackoverflow.com/questions/2831253/using-boostasioasync-read-with-stdin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!