This code generate an exception with unknow code.Code:unsigned char *CharToBit (char pValue){ unsigned char *cByte; unsigned int iCharASCII, iBit = 0; int iCont; iCharASCII = pValue; for (iCont=7; iCont>=0; iCont--){ iBit = iCharASCII % 2; iCharASCII = iCharASCII / 2; if (iBit == 1){ cByte [iCont] = '1'; } else { cByte [iCont] = '0'; } } cByte [8] = '\0'; return cByte; } .......... cFlag = substr (cStatus, 1,1); cFuncRes = cFlag [0]; // + '\0'; cFlag = CharToBit (cFuncRes);
is There an specific function to convert a Char ASCII to Binary ?