for (int i = 0; i < numRows*(numCols*3+padding); ++i) cout << (int) imageptr[i] << " ";
This is a simplified version of my code to demonstrate the problem (I'm using unsigned chars of course and skipping over the padding at the end of the rows). so basically the cout at the end should be spamming me with all different sorts of values between -127 and 127, but instead I'm getting only -51, with a few groupings of 0's here and there. How could this be?
So basically what happens when I read in information like this from an image, and use it write another bmp file, I get a picture with the exact same dimensions as the original, only its all grey with a few black specks here and there. (I think -51 is 205 or something unsigned). I don't understand how I can read a file and get the same character values over and over when they should be changing dramatically.
Did you try reading your file in hex mode to see just what you should be seing?
AFAIK, a lot of bitmap files per-pixel pad to 4 bytes (rather than per row). You may want to double check your file using an external hex editor.
You could also try something simpler: Forget everything about bitmaps, and imagine your file is just plain raw data. Try to read that and print the values. Your success (or failure) of achieving this should give you a good idea of where you went wrong.
Is your question related to IO?
Read this C++ FAQ LITE article at parashift by Marshall Cline. In particular points 1-6.
It will explain how to correctly deal with IO, how to validate input, and why you shouldn't count on "while(!in.eof())". And it always makes for excellent reading.
I found the error... the bitmap I was using to test somehow got corrupted and didn't think to check that. I probably overwrote it a long time ago while testing and wasted a whole day of programming lol