Decimal to HEX value help

Hi, i am making a little c++ program, that should generate a .bmp file. The problem is that after calculating the file width value I end up with a decimal and I need to write it as a HEX value. Is there some kind of a function which can do the convertion, or should I make one on my own?
In computers all data is in binary. If you cout << something and see it in decimal, that's because << performs a conversion. If you ever need to print a hex number, there are iomanip functions for that. BMP however is a binary file, so you need to fstream::write the int you need.
Thanks, got it working!
Topic archived. No new replies allowed.