Lectura y escritura de archivos binarios

Estoy tratando de escribir código para leer un archivo binario en un búfer, luego escribir el búfer en otro archivo. Tengo el siguiente código, pero el búfer solo almacena un par de caracteres ASCII de la primera línea del archivo y nada más.

int length;
char * buffer;

ifstream is;
is.open ("C:\\Final.gif", ios::binary );
// get length of file:
is.seekg (0, ios::end);
length = is.tellg();
is.seekg (0, ios::beg);
// allocate memory:
buffer = new char [length];
// read data as a block:
is.read (buffer,length);
is.close();

FILE *pFile;
pFile = fopen ("C:\\myfile.gif", "w");
fwrite (buffer , 1 , sizeof(buffer) , pFile );

Respuestas a la pregunta(7)

Su respuesta a la pregunta