December 06, 2007

Convert Any Value Type to STL String by Stringstream

#include <sstream>

using namespace std;

int a = 1;
double b = 2.0;
float c = 3.0;
unsigned int d = 4;
long long f = 5;
__int64 g = 6;

wstringstream stream; (use stringstream for string)
wstring str;
stream << g; (this can be replaced by any value type)
stream >> str;