Menu

Final Challenge Create Binary File Using Streams Contains N Blocks Equal Fixed Size Fixed Q43861000

For this problem, using the followingtemplate

For our final challenge, you will create a binary file (using streams) that contains N blocks of an equal (fixed) size. Each#include BinaryStreamWriter.hpp namespace A { BinaryStreamWriter::BinaryStreamWriter(const char* aPath, const char* aFilena

#ifndef BinaryStreamWriter_hpp #define BinaryStreamWriter_hpp #include <stdio.h> #include <fstream> Enamespace A { class Bina

For our final challenge, you will create a binary file (using streams) that contains N blocks of an equal (fixed) size. Each fixed- sized block will contain characters of a given value. No two blocks will contain the same character. You might mentally visualize the block sequence like this: AAAAAA BBBBBB CCCCC DDDDDD (etc) Opening a stream in “binary” mode is done using settings, which have already been set up for you on the BinaryStreamwriter class. Your job will be to write blocks of data, filled with a given character, into the binary stream. Once again, your project contains a good start on the code necessary to do this work. Just look for comments in the code that indicate where you need to add code. #include “BinaryStreamWriter.hpp” namespace A { BinaryStreamWriter::BinaryStreamWriter(const char* aPath, const char* aFilename) { char thePath[512]; sprintf (thePath, “%s/%s”. aFilename); aPath, //STUDENT: open your output stream in binary mode… int BinarystreamWriter: :run (int aBlockCount, size t aBlockSize) { //iterate for 1..aBlockCount //create a buffer of given size (aBlockSize) //fill the buffer with a unique char from alphabet.. //write each block sequentially to binary stream… return 0; #ifndef BinaryStreamWriter_hpp #define BinaryStreamWriter_hpp #include <stdio.h> #include <fstream> Enamespace A { class BinaryStreamWriter { public: BinaryStreamWriter(const char* aPath, const char* aFilename); int run (int aBlockCount, size t aBlockSize=32); protected: //STUDENT: declare your binary stream here… } ; #endif /* BinaryStreamWriter_hpp * / Show transcribed image text For our final challenge, you will create a binary file (using streams) that contains N blocks of an equal (fixed) size. Each fixed- sized block will contain characters of a given value. No two blocks will contain the same character. You might mentally visualize the block sequence like this: AAAAAA BBBBBB CCCCC DDDDDD (etc) Opening a stream in “binary” mode is done using settings, which have already been set up for you on the BinaryStreamwriter class. Your job will be to write blocks of data, filled with a given character, into the binary stream. Once again, your project contains a good start on the code necessary to do this work. Just look for comments in the code that indicate where you need to add code.
#include “BinaryStreamWriter.hpp” namespace A { BinaryStreamWriter::BinaryStreamWriter(const char* aPath, const char* aFilename) { char thePath[512]; sprintf (thePath, “%s/%s”. aFilename); aPath, //STUDENT: open your output stream in binary mode… int BinarystreamWriter: :run (int aBlockCount, size t aBlockSize) { //iterate for 1..aBlockCount //create a buffer of given size (aBlockSize) //fill the buffer with a unique char from alphabet.. //write each block sequentially to binary stream… return 0;
#ifndef BinaryStreamWriter_hpp #define BinaryStreamWriter_hpp #include #include Enamespace A { class BinaryStreamWriter { public: BinaryStreamWriter(const char* aPath, const char* aFilename); int run (int aBlockCount, size t aBlockSize=32); protected: //STUDENT: declare your binary stream here… } ; #endif /* BinaryStreamWriter_hpp * /

Expert Answer


Answer to For our final challenge, you will create a binary file (using streams) that contains N blocks of an equal (fixed) size. …

OR