That is fine until you get a bitmap where the bitmap has padding at the end of the line.
E.g. a B&W bitmap 14 pixels wide has a 2-byte width, with two columns of unused pixels.
Or for higher bit-depth examples: BMP file format - Wikipedia, the free encyclopedia
But there are hundreds of little gotchas like that with the BMP format, which is why I recommend something like the DIB24 class I posted a link to earlier, assuming this is for Windows only.