Hello there. :)
I tried all day yesterday to figure out what was wrong with this code so I thought I'd ask here.
I have to write a program that duplicates a 24-bit (RGB) bitmap file while also inverting the image.

The only problem seems to be copying the pixel data over. The headers copy fine but I always get very strange images whenever I run the program.

Here is the part that should copy the pixel data:

//Get number of pixels
	numPixels = infoHeader.biHeight * infoHeader.biWidth;

	//Allocate space for each pixel
	pixels = (RGBTRIPLE *) malloc(numPixels * sizeof(RGBTRIPLE));

	//Check space has been allocated
	if(pixels == NULL)
		printf("Error allocating memory");

	//Move pointer to start of pixel data
	fseek(file, fileHeader.bfOffBits, SEEK_SET);

	///Read all pixels in
	fread(pixels, 3, numPixels, file);
	printf("Pixels read.");

	//Write pixels to file
	fseek(newFile, fileHeader.bfOffBits, SEEK_SET);
	fwrite(pixels, 3, numPixels, newFile);
	printf("Pixels written");

Is there anything obviously wrong with this code?
Here's an example of the original image and results: Click me.