/build/static/layout/Breadcrumb_cap_w.png

How to break binary file into chunks and store these chunks on file system and again restore it

Hi

By using the C++ programming on windows /Linux, Please suggest way to achieve below functionality:

1. How to break binary file into chunks and store these chunks on the file system
2. And read these chunks from the filesystem
3. and restore the original binary file

Thank You

1 Comment   [ + ] Show comment
  • 1. How to break binary file into chunks and store these chunks on the file system in single file

    As per the current implementation, we have read the binary file by using ifstream [binary mode] and break it into the chunks.

    And write these chunks on the file system, by using ofstream [binary mode], and while writing the chunks into the single file new line character [\n] is used to between two chunks.

    2. And read these chunks from the filesystem

    Intermediate file is read by using the ifstream[binary mode] and while retrieving the data (chunks) from the intermediate file in order to get the original data [\n] is checked and skipped.

    but in this approach, I think there were some [\n] characters which were exists in the original binary file content are also gets skipped, due to this problem original binary file cannot be created from the intermediate file.

    3. and restore the original binary file

    Please suggest correct way to write binary chunks in intermediate file and restore it back in original binary contents. - programmer1983 8 years ago

Answers (2)

Posted by: cbreuer@bscsd.org 8 years ago
Senior White Belt
0
Most developers put an int for the chunk size before each chunk then read that amount of data.
or use zlib compression in your chunks and read that.
Posted by: anonymous_9363 8 years ago
Red Belt
0
Wow! You're a programmer and yet seemingly still unable to use Google.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ