How would I decompress a bzip2-compressed byte array using boost? I found an example here, but the input is a file hence the use of ifstream. The documentation isn’t very clear for me :(.
Edit: I’ll accept alternatives to boost.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s my code using DEFLATE compression in the boost.iostreams library; I’m sure you can hook in the corresponding BZip2 compressor instead:
The bzip2 compressor is called
bzip2_(de)compressor().If you want a byte buffer rather than a file, use a string stream: