MCPcopy Create free account
hub / github.com/boostorg/filesystem / copy_file

Function copy_file

example/mbcopy.cpp:32–63  ·  view source on GitHub ↗

we can't use boost::filesystem::copy_file() because the argument types differ, so provide a not-very-smart replacement.

Source from the content-addressed store, hash-verified

30// we can't use boost::filesystem::copy_file() because the argument types
31// differ, so provide a not-very-smart replacement.
32void copy_file(const fs::wpath& from, const user::mbpath& to)
33{
34 fs::ifstream from_file(from, std::ios_base::in | std::ios_base::binary);
35 if (!from_file)
36 {
37 std::cout << "input open failed\n";
38 return;
39 }
40
41 fs::ofstream to_file(to, std::ios_base::out | std::ios_base::binary);
42 if (!to_file)
43 {
44 std::cout << "output open failed\n";
45 return;
46 }
47
48 char c;
49 while (from_file.get(c))
50 {
51 to_file.put(c);
52 if (to_file.fail())
53 {
54 std::cout << "write error\n";
55 return;
56 }
57 }
58
59 if (!from_file.eof())
60 {
61 std::cout << "read error\n";
62 }
63}
64
65} // namespace
66

Callers 5

mainFunction · 0.70
do_the_right_thing_testsFunction · 0.50
copy_file_testsFunction · 0.50
mainFunction · 0.50
myFuncFunction · 0.50

Calls 1

getMethod · 0.80

Tested by 2

do_the_right_thing_testsFunction · 0.40
copy_file_testsFunction · 0.40