/build/static/layout/Breadcrumb_cap_w.png

Software Question


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

05/13/2016 824 views
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.

All 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

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

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