首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

! Bitset怎样转换成CStiring?

2012-03-09 
紧急求助!!! Bitset怎样转换成CStiring??以下两个是从char型转到Bitset型,及Bitset转到char型的,但是第二

紧急求助!!! Bitset怎样转换成CStiring??
以下两个是从char型转到Bitset型,及Bitset转到char型的,但是第二段代码调用的时候老是报错,错误如下:

DESDlg.obj : error LNK2019: 无法解析的外部符号 "public: void __thiscall CBC::ConvertToChar(class std::bitset<64> const &,unsigned char * const)" (?ConvertToChar@CBC@@QAEXABV?$bitset@$0EA@@std@@QAE@Z),该符号在函数 "public: void __thiscall CDESDlg::OnBnClickedOk(void)" (?OnBnClickedOk@CDESDlg@@QAEXXZ) 中被引用
1>C:\Users\Administrator\Desktop\DES\Debug\DES.exe : fatal error LNK1120: 1 个无法解析的外部命令。

代码:
void CBC::ConvertToBitSet(char* str , bitset<64>& BitSet )
{
int i = 0 , j = 0 , index = 0 ;
for( i = 0 ; i < 8 ; ++ i )
{
bitset<8> regBitSet( str[ i ] ) ;
for( index = i * 8 , j = 7 ; index < i * 8 + 8 && j >= 0 ; ++ index , -- j )
{
BitSet.set( index , regBitSet[ j ] ) ;
}
}
}

void ConvertToChar( std::bitset<64> BitSet , unsigned char *buffer )
{

for( int i = 0 ; i < 8 ; i ++ )
{
unsigned char c = 0 ;
for( int j = 0 ; j < 8 ; j ++ )

c = c * 2 + BitSet[ i * 8 + j ] ;
}
buffer[ i ] = c ;
}
希望大神帮助帮助我这位小菜鸟,谢谢!

[解决办法]
ConvertToChar( std::bitset<64> BitSet , unsigned char *buffer ) 前面的 CBC:: 不见了

热点排行