convert a vector<string> into a string
This is my vector:
Code:
vector<string> ext;
exts.push_back(TEXT("png"));
exts.push_back(TEXT("jpg"));
exts.push_back(TEXT("gif"));
exts.push_back(TEXT("bmp"));
I wan to create the vector into a string to have like the OPENFILENAME::lpstrFilter, that would be something like:
Code:
string final = "All files supported\0*.png;*.jpg;*.gif;*.bmp\0\0";
Right now I'm using something like this:
Code:
vector<string> ext;
stringstream str;
ext.push_back("png");
ext.push_back("jpg");
ext.push_back("bmp");
ext.push_back("gif");
size_t len = ext.size();
str << "All files supported\0";
for (size_t pos = 0; pos != len; pos++ )
{
str << "*." << ext[pos] << ";";
}
str << "\0\0";
// use str.str().c_str() as filter
But doesn't work :(
any ideas?