我有一个我创建的二进制文件.在其中,数据以二进制形式存储,但我将以人类可读的形式显示;
[someOtherData]6759A_block$[someOtherData]
Run Code Online (Sandbox Code Playgroud)
我在temp_S中保存了数据"6759A_block $",它被声明为字符串.现在,我希望从temp_S开始分割前3个字节,然后将其存储在unsigned int中.为了实现我的愿望,我写了下面的代码段;
unsigned int number;
{
string tmp ( temp_S , 0 ,3 );
istringstream temp_Istream ( tmp ) ;
temp_Istream >> number;
}
Run Code Online (Sandbox Code Playgroud)
但是,当我编译我的小程序时,它会显示如下错误;
error: variable ‘std::istringstream temp_S’ has initializer but incomplete type
Run Code Online (Sandbox Code Playgroud)
我的问题是:
编辑:
Naw*_*waz 14
当您忘记这一点时,GCC会给出错误:
#include <sstream> //this is where istringstream is defined
Run Code Online (Sandbox Code Playgroud)