the difference between <cstring> <sstream> <string>
can somebody help me to explain this , and give some example
Printable View
the difference between <cstring> <sstream> <string>
can somebody help me to explain this , and give some example
Quote:
Originally Posted by walkinginwater
- '<cstring>' is provided only for backward compatibility with ANSI C and provides the global string functions such as 'strcpy', 'strcat', 'memcpy' etc.
- '<sstring>' is not a header I know....I assume you rather mean '<sstream>' which provides the stream classes for strings.
- '<string>' is the header file for the STL 'string' class...
A sample would be
Code:#include <iostream>
#include <sstream>
#include <string>
int main()
{
std::ostringstream oss;
oss << 10;
std::string str = oss.str();
std::cout << str << std::endl;
return 0;
}