{"id":3286,"date":"2020-07-23T12:56:52","date_gmt":"2020-07-23T12:56:52","guid":{"rendered":"https:\/\/raspberry-projects.com\/pi\/?p=3286"},"modified":"2020-07-23T12:56:54","modified_gmt":"2020-07-23T12:56:54","slug":"copy-file","status":"publish","type":"post","link":"https:\/\/raspberry-projects.com\/pi\/programming-in-c\/file-input-and-output\/working-with-files\/copy-file","title":{"rendered":"Copy File"},"content":{"rendered":"\n<p>There is no C++ function for this. &nbsp;The fastest way is to open the file, read it byte by byte and write it out to the new file as you go (or use a library like boost which can do this). &nbsp;A slower way is just to use a system call<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdlib.h>\n\tsystem(\"cp file.x newfile.x\");<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>There is no C++ function for this. &nbsp;The fastest way is to open the file, read it byte by byte and write it out to the new file as you go (or use a library like boost which can do this). &nbsp;A slower way is just to use a system call<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[158],"tags":[],"class_list":["post-3286","post","type-post","status-publish","format-standard","hentry","category-working-with-files"],"_links":{"self":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/3286","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/comments?post=3286"}],"version-history":[{"count":1,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/3286\/revisions"}],"predecessor-version":[{"id":3287,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/posts\/3286\/revisions\/3287"}],"wp:attachment":[{"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/media?parent=3286"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/categories?post=3286"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/raspberry-projects.com\/pi\/wp-json\/wp\/v2\/tags?post=3286"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}