windows.qbk
来自「Boost provides free peer-reviewed portab」· QBK 代码 · 共 92 行
QBK
92 行
[/ / Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot com) / / Distributed under the Boost Software License, Version 1.0. (See accompanying / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) /][section:windows Windows-Specific Functionality][link boost_asio.overview.windows.stream_handle Stream-Oriented HANDLEs][link boost_asio.overview.windows.random_access_handle Random-Access HANDLEs][section:stream_handle Stream-Oriented HANDLEs]Boost.Asio contains classes to allow asynchronous read and write operations to beperformed on Windows `HANDLE`s, such as named pipes.For example, to perform asynchronous operations on a named pipe, the followingobject may be created: HANDLE handle = ::CreateFile(...); windows::stream_handle pipe(my_io_service, handle);These are then used as synchronous or asynchronous read and write streams. Thismeans the objects can be used with any of the [link boost_asio.reference.readread()], [link boost_asio.reference.async_read async_read()], [linkboost_asio.reference.write write()], [link boost_asio.reference.async_writeasync_write()], [link boost_asio.reference.read_until read_until()] or [linkboost_asio.reference.async_read_until async_read_until()] free functions.The kernel object referred to by the `HANDLE` must support use with I/Ocompletion ports (which means that named pipes are supported, but anonymouspipes and console streams are not).[heading See Also][link boost_asio.reference.windows__stream_handle windows::stream_handle],[link boost_asio.reference.windows__basic_stream_handle windows::basic_stream_handle],[link boost_asio.reference.windows__stream_handle_service windows::stream_handle_service].[heading Notes]Windows stream `HANDLE`s are only available at compile time when targetingWindows and only when the I/O completion port backend is used (which is thedefault). A program may test for the macro `BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE` todetermine whether they are supported.[endsect][/-----------------------------------------------------------------------------][section:random_access_handle Random-Access HANDLEs]Boost.Asio provides Windows-specific classes that permit asynchronous read and writeoperations to be performed on HANDLEs that refer to regular files.For example, to perform asynchronous operations on a file the following objectmay be created: HANDLE handle = ::CreateFile(...); windows::random_access_handle file(my_io_service, handle);Data may be read from or written to the handle using one of the`read_some_at()`, `async_read_some_at()`, `write_some_at()` or`async_write_some_at()` member functions. However, like the equivalentfunctions (`read_some()`, etc.) on streams, these functions are only requiredto transfer one or more bytes in a single operation. Therefore free functionscalled [link boost_asio.reference.read_at read_at()], [linkboost_asio.reference.async_read_at async_read_at()], [link boost_asio.reference.write_atwrite_at()] and [link boost_asio.reference.async_write_at async_write_at()] have beencreated to repeatedly call the corresponding [^[**]_some_at()] function untilall data has been transferred.[heading See Also][link boost_asio.reference.windows__random_access_handle windows::random_access_handle],[link boost_asio.reference.windows__basic_random_access_handle windows::basic_random_access_handle],[link boost_asio.reference.windows__random_access_handle_service windows::random_access_handle_service].[heading Notes]Windows random-access `HANDLE`s are only available at compile time whentargeting Windows and only when the I/O completion port backend is used (whichis the default). A program may test for the macro`BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE` to determine whether they aresupported.[endsect][endsect]
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?