I am looking for a way to split an array into multiple arrays in C/C++, with standard Win32 and C/C++ functions.
Here's an example, how I read a file into the array.
using namespace std;
LPSTR File_To_Read = "FILE.exe";
DWORD File_To_Read_Size = NULL;
DWORD inputSize = NULL;
PBYTE inputData = NULL;
ifstream input(File_To_Read, ifstream::binary | ifstream::ate);
File_To_Read_Size = static_cast<DWORD>(input.tellg());
input.seekg(input.beg);
inputData = new BYTE[File_To_Read_Size];
input.read(reinterpret_cast<char*>(inputData), File_To_Read_Size);
input.close();
Now I want to split the inputData like this.
DWORD inputSize_part1;
DWORD inputSize_part2;
DWORD inputSize_part3;
PBYTE inputData_part1;
PBYTE inputData_part2;
PBYTE inputData_part3;
So in the later I can also put them back together.
How should I proceed? I would show an example code what I have tried, but my code would not make not much sense for you experts.
Edit: @IKH Chunk sizes should be around the same size. So if inputData is 33kb, then inputData_part1(and inputSize_part1) should be 11kb, inputData_part2(and inputSize_part2) should be 11kb, and so on. So in the end there would be 3x 11kb arrays and DWORDS for their sizes.
I would show an example code what I have tried, but my code would not make not much sense for you experts.Oh, stop it, you :$ Show us the code anyway.int *arr1 = fullarray; int *arr2 = fullarray + chunksize; int *arr3 = fullarray + 2 * chunksize;