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

Comments

  • 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.
Please log in to comment

Answers

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.
Answered 05/17/2016 by: cbreuer@bscsd.org
Senior White Belt

Please log in to comment
0
Wow! You're a programmer and yet seemingly still unable to use Google.
Answered 05/16/2016 by: VBScab
Red Belt

Please log in to comment
Answer this question or Comment on this question for clarity