i am using object of stringstream as follows:
#include<iostream>
#include <istream>
using namespace std;
int main()
{
sting str="my.string";
std::stringstream message("HI this is firet line from initialization");
message << " second line " << " Continuing second line";
message << ", Add values: ";
message << str ;
std::cout<<"message value is :"<<message.str()<<std::endl;
return 0;
}
with above code it gives an error as follows:
error: variable 'std::stringstream message' has initializer but incomplete type
above error is resolved once i added the "#include " header file. but when i printed the value of message. it is getting incomplete. i.e. value i got of message is as follows:
message value is : second line Continueing second linetion , Add values: my.string
any suggestion on why first line is removing in output? Thanks in advance
#include <sstream>
? – Carposporesting
is not valid in this context. – Dacoity