I
Immortal Nephi
I want to store data into char array. Look at my example below.
#include <strstream>
#include <sstream>
using namespace std;
int main()
{
char s[25];
std:strstream myString( s, sizeof( s ) );
// std:stringstream myString( s, sizeof( s ) );
myString << "this is a test" << std::ends;
char t[ 4 ] = { 1, 2, 3, 4 };
myString.write( reinterpret_cast<char*>( t ), sizeof(char)*4 );
return 0;
}
MSDN documentation says The classes in <strstream> are deprecated.
Consider using the classes in <sstream> instead.
I change from std:strstream myString( s, sizeof( s ) ) to
std:stringstream myString( s, sizeof( s ) )
Why myString is unable to store data into s array?
#include <strstream>
#include <sstream>
using namespace std;
int main()
{
char s[25];
std:strstream myString( s, sizeof( s ) );
// std:stringstream myString( s, sizeof( s ) );
myString << "this is a test" << std::ends;
char t[ 4 ] = { 1, 2, 3, 4 };
myString.write( reinterpret_cast<char*>( t ), sizeof(char)*4 );
return 0;
}
MSDN documentation says The classes in <strstream> are deprecated.
Consider using the classes in <sstream> instead.
I change from std:strstream myString( s, sizeof( s ) ) to
std:stringstream myString( s, sizeof( s ) )
Why myString is unable to store data into s array?