|
-
December 6th, 2004, 05:17 AM
#1
the difference between <cstring> <sstream> <string>
the difference between <cstring> <sstream> <string>
can somebody help me to explain this , and give some example
Last edited by walkinginwater; December 6th, 2004 at 05:43 AM.
Reason: there is a mistake in my post
-
December 6th, 2004, 05:28 AM
#2
Re: the difference between <cstring> <sstring> <string>
 Originally Posted by walkinginwater
the difference between <cstring> <sstring> <string>
can somebody help me to explain this , and give some example
- '<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;
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|