How do I convert from std::stringstream to std::string in C++?
Do I need to call a method on the string stream?
i tried .str() but didnt work.
it copies string into stream and pass it as argument for the method addDoc above.when i tried to convert it back to string it didnt work saying .str() is not a member of &inStream.Code://cpp Document*Repository::addDoc(iostream& inStream,string docId) //test core Repository r1; stringstream ss; string s1 = "Hello World;" ss.clear(); ss<<s1; r1.addDoc(ss,"1")
but why is that since it is already been convert to stream in the test core and should be passed as stream form for the method.
can anyone explain this to me?
thanks