使用boost的mapped file

來源:互聯網
上載者:User

標籤:mapped_file_source   mapped_file_params   mapped_file_sink   

#include <boost/iostreams/device/mapped_file.hpp>std::string src_path = "/Users/alex/Movies/m3u8_videos/dance.mp4";std::string dst_path = "/Users/alex/Movies/m3u8_videos/dance-copy.mp4";void copy_file(){boost::iostreams::mapped_file_params  params_src;params_src.path = src_path;boost::iostreams::mapped_file_source  mf_src;mf_src.open(params_src);if(mf_src.is_open()){unsigned char* p_src = (unsigned char*)mf_src.data();size_t len_src = mf_src.size();boost::iostreams::mapped_file_params  params_dst;params_dst.path = dst_path;params_dst.new_file_size = len_src;boost::iostreams::mapped_file_sink  mf_dst;mf_dst.open(params_dst);if(mf_dst.is_open()){unsigned char* p_dst = (unsigned char*)mf_dst.data();for(size_t i = 0; i < len_src ; i++){*(p_dst + i) = *(p_src + i);}mf_dst.close();}mf_src.close();}}int main(){<span style="white-space:pre"></span>copy_file();<span style="white-space:pre"></span>return 0;}


使用boost的mapped file

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.