First off, I see you're using %d, which is reference to decimal, yet you use an 8-digit int index, which refers to octal. Know that octal is represented as %o.
This is an easy-to convert int to binary:
char binary[33];
int integer = 255;
_itoa(integer, binary, 2);
So, in the place of 255 add your input data.