I too think this is drop dead simple. Just figure out what the headers are for a BMP for the image size of your choice, and stick them in an array as constant bytes. When you want to write the BMP file, write out the constant bytes and then the pixels. Need not even mess with building a header - just save a BMP file in a paint program for the dimensions and color depth you want, and use the spec to figure out which bytes are the header and which are the pixels.
And that, of course, would be endian-neutral code, right ?
Yes because it would be an array of bytes (specifically chars in C++) which don't have endianness problems.
If he needed to change the array (e.g. to accommodate a different height or width for the image) then he'd need to make sure he puts the height and width into the header with proper respect for endianness. But in the simplest case, he'd be using a fixed size image using a canned height and width.
Then when he gets to actually putting out the pixels, he puts 3 bytes (one for R, one for G, and one for B).
I recall the BMP format also requiring each row to start on a 32-bit boundary, so at the end of each row, up to three null bytes must be added for padding to accommodate this (the number of bytes needed depends on the image width).