ALT Linux Bugzilla
– Attachment 16362 Details for
Bug 50790
Прошу обновить пакет libboost до 1.77
New bug
|
Search
|
[?]
|
Help
Register
|
Log In
[x]
|
Forgot Password
Login:
[x]
|
EN
|
RU
Пример для проверки исправления бага
copy_file_test.cpp (text/x-c++src), 1.82 KB, created by
Владимир Старосельцев
on 2024-07-02 22:46:30 MSK
(
hide
)
Description:
Пример для проверки исправления бага
Filename:
MIME Type:
Creator:
Владимир Старосельцев
Created:
2024-07-02 22:46:30 MSK
Size:
1.82 KB
patch
obsolete
>//$ g++ copy_file_test.cpp -lboost_filesystem -o copy_file >//$ ./copy_file /tmp/.private/$USER /home/$USER > >#include <boost/filesystem.hpp> >#include <iostream> > >using namespace std; > >int main(int argc, char** argv) { > if (argc < 3) { > cerr << "УкажиÑе иÑÑ Ð¾Ð´Ð½ÑÑ Ð¸ ÑелевÑÑ Ð´Ð¸ÑекÑоÑии" << endl; > cerr << argv[0] << " [иÑÑ Ð¾Ð´Ð½Ð°Ñ Ð´Ð¸ÑекÑоÑиÑ] [ÑÐµÐ»ÐµÐ²Ð°Ñ Ð´Ð¸ÑекÑоÑиÑ]" << endl; > return EXIT_FAILURE; > } > > string paths[2]; > for (size_t i = 1; i < 3; ++i) { > if (!boost::filesystem::is_directory (argv[i])) { > cerr << "'" << argv[i] << "' должна бÑÑÑ ÑÑÑеÑÑвÑÑÑей диÑекÑоÑией" << endl; > return EXIT_FAILURE; > } > > paths[i - 1] = (boost::filesystem::path (argv[i]) / "TestFile.txt").string(); > } > > > > ofstream tempFile (paths[0], ofstream::out); > tempFile << "Lorem ipsum dolor sit amet" << endl; > tempFile.close(); > > if (rename (paths[0].c_str(), paths[1].c_str()) == 0) { > cerr << "ÐÑÑ Ð¾Ð´Ð½Ð°Ñ Ð¸ ÑÐµÐ»ÐµÐ²Ð°Ñ Ð´Ð¸ÑекÑоÑии ÑазмеÑÐµÐ½Ñ Ð½Ð° одном ÑÑÑÑойÑÑве" << endl; > remove (paths[1].c_str()); > return EXIT_FAILURE; > } > > if (errno != EXDEV) { > cerr << "ÐÑоизоÑла дÑÑÐ³Ð°Ñ Ð¾Ñибка пÑи копиÑовании Ñайла: " << strerror(errno) << endl; > remove (paths[0].c_str()); > return EXIT_FAILURE; > } > > try { > boost::filesystem::copy_file (paths[0], paths[1], boost::filesystem::copy_options::overwrite_existing); > for (size_t i = 0; i < 2; ++i) > remove (paths[i].c_str()); > cout << "ТеÑÑ Ð·Ð°Ð²ÐµÑÑилÑÑ ÑÑпеÑно!" << endl; > return EXIT_SUCCESS; > } catch (boost::filesystem::filesystem_error &ex) { > for (size_t i = 0; i < 2; ++i) > remove (paths[i].c_str()); > cerr << "ТеÑÑ Ð·Ð°Ð²ÐµÑÑилÑÑ Ð½ÐµÑдаÑей: " << ex.what() << endl; > return EXIT_FAILURE; > } >} >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 50790
: 16362