K> есть файл бинарный на диске. задача считать его в память (в массив какой-то) по заданному указателем адресу и вернуть его размер, а затем записать и3 памяти в файл.
#include <fstream>
#include <algorithm>
using namespace std;
const int MAX_SIZE = 1000000;
char buf[ MAX_SIZE + 1];
int main()
{
ifstream fin ("1.txt", ios::in | ios::binary);
fin.read (buf, MAX_SIZE);
int num_read = fin.gcount();
fin.close();
ofstream fout ("2.txt", ios::out | ios::binary);
fout.write (buf, num_read);
fout.close();
}