Using istringstream gives an error | What for

I have one binary that I created. In it, the data is stored in binary form, but I will show them in a human-readable form, for example:

 [someOtherData]6759A_block$[someOtherData]

I keep this data "6759A_block $" in temp_S, which is declared as a string. Now I want to split the first 3 bytes from temp_S, and then save it in unsigned int. To fulfill my wish, I write below the code segment;

 unsigned int number;
 { 
 string tmp ( temp_S , 0  ,3 ); 
 istringstream temp_Istream ( tmp ) ;
 temp_Istream >> number;
 }

However, when I compile my small program, it gives the error shown below;

error: variable ‘std::istringstream temp_S’ has initializer but incomplete type

My questions:

  • What is the meaning of this compiler error?
  • How can I fix this problem and take the first three bytes of data in an unsigned int?

EDIT:

  • linux platform
  • g ++
+5
source share
1 answer

GCC , :

#include <sstream> //this is where istringstream is defined
+13

All Articles