用C++模式格式化字符串

用C++方式格式化字符串
我们常用wsprintf或者sprintf格式化字符串,这都是C的方式,要是用C++ STL 的方式怎么做,没研究过STL这些东西!下面是一小段代码:
#include <iostream>
using std::cout;
using std::endl;
using std::hex;
using std::showbase;

#include <string>
using std::string;

#include <Windows.h>

#include <sstream>
using std::ostringstream;

#include <iomanip>
using std::setw;
using std::setfill;

int main(int argc, char *argv[])
{
ostringstream ssTest;
ostringstream wTest;
unsigned long dwFlags[] = {9845793, 875885, 763534, 903842};
int len = sizeof(dwFlags) / sizeof(dwFlags[0]);
for ( int i=0; i<len; i++)
{
ssTest << dwFlags[i] << endl;
}

wchar_t wFlags1[] = L"shenzhenshi";
wchar_t wFlags2[] = L"nanningshi";
wchar_t wFlags3[] = L"guangzhousi";
wchar_t wFlags4[] = L"zhuhaishi";

wchar_t wResult[128];
wsprintf(wResult, "%s,%s,%s,%s", wFlags1, wFlags2, wFlags3, wFlags4);
char cTemp[128];
WideCharToMultiByte(CP_ACP, 0, wFlags1, sizeof(wFlags1)/sizeof(wchar_t), cTemp, 
sizeof(wFlags1)/sizeof(wchar_t), NULL, false);

wTest << wFlags1 << wFlags2 << wFlags3 << wFlags4 << '\0';

cout << ssTest.str();
cout << wResult << endl;
}

比如上面我格式化wResult的时候用的是wsprintf,要是用STL C++方式该怎么写?

------解决方案--------------------
打印到stream流,最后的结果可以拷贝到字符串中,也可以用string来存储。
#include <iostream>
#include <sstream>
#include <string>
using namespace std;

int main()
{
wchar_t wFlags1[] = L"shenzhenshi";
wchar_t wFlags2[] = L"nanningshi";
wchar_t wFlags3[] = L"guangzhousi";
wchar_t wFlags4[] = L"zhuhaishi";

wchar_t wResult[128];
wstring wstr;
wostringstream wos;
wos << wFlags1 << L',' << wFlags2 << L','
<< wFlags3 << L',' << wFlags4;
wcscpy(wResult, wos.str().c_str());
wstr = wos.str();
wcout << wResult << endl;
wcout << wstr << endl;
return 0;
}