The following code is targetted at converting a single byte into binary and setting a CVI string control accordingly, but I'm sure you will be able to adapt its ideas to suit your application:
//*****************************************************************************************
void ShowBin (int ctrl, int val) { // Display data in binary
char str [9];
int i, patt = 0x80;
str [8] = 0; // Terminate string
for (i = 0; i < 8; i++, patt >>= 1) // Repeat for each bit
str [i] = val & patt ? '1': '0'; // Select a 1 or a 0
SetCtrlVal (pan, ctrl, str); // Update display
}
//*****************************************************************************************
JR