Replies: 1 comment 3 replies
-
Hi! Anyway, the progress callback is a Usually, it is used together with the total callback to calculate, for example, the current progress percentage: std::uint64_t totalSize = 0;
writer.setTotalCallback([&]( std::uint64_t total ) {
totalSize = total;
});
writer.setProgressCallback([&total]( std::uint64_t progress ) -> bool {
const auto percentage = static_cast<int>(
100.0 * (static_cast<double>(progress) / static_cast<double>(total))
);
std::cout << "Compression progress: " << percentage << "%" << std::endl;
return true;
}); Please note that 7-Zip callbacks are blocking, so if you do some heavy operations in the body of the callback, it might slow down the compression (or extraction) operation. |
Beta Was this translation helpful? Give feedback.
-
Is there an example on how to use the progress callback from BitArchiveWriter, BitArchiveEditor, and BitArchiveReader?
Beta Was this translation helpful? Give feedback.
All reactions