二进制字符串转十进制数字

unsigned int bin2int (std::string strBin)
{
    unsigned int i = 0;
    const char *pch = strBin.c_str();
    while (*pch == '0' || *pch == '1') {
	i <<= 1;
	i |= *pch++ - '0';
    }

    return i;
}

 

    原文作者:进制转换
    原文地址: https://blog.csdn.net/laplaya/article/details/84570193
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞