asio
asio copied to clipboard
Open files on Windows shared with another process
Currently, asio opens files on Windows with no share mode enabled. (https://github.com/chriskohlhoff/asio/blob/asio-1-22-1/asio/include/asio/detail/impl/win_iocp_file_service.ipp#L94).
Is there any way to allow another process writing into a file while reading the same file with asio?
Manually setting FILE_SHARE_READ | FILE_SHARE_WRITE for dwShareMode in the CreateFileA call helped in this specific case.
Interestingly, using std::ifstream for this does work; the same file can be written to from elsewhere while it is opened as std::ifstream.