Controlling 8-bit DAC Output over I2C-- decimal to binary char conversion help
Since "dec" is an int, it is already a binary value.  You just need to ensure it is between 0 and 255 inclusive, and send it to the DAC - no need for any decimal to binary conversion (and your messing about with character arrays and strings is no use at all).

It might be useful to see how you set "dec" to the desired value...