如何将 vector 字符串的值传递给 C++ 中的 win32 函数 SetWindowText。
到目前为止,这是我的代码:
vector <string> filelist;
string path;
path = Text;
filelist = GetPath(path);
SetWindowText(EditShow,filelist);
最佳答案
您可以将它们全部连接成一个字符串并将其作为 C 字符串传递:
#include <sstream> // for std::stringstream
#include <algorithm> // for std::copy
#include <iterator> // for std::ostream_iterator
std::stringstream buffer;
std::copy(filelist.begin(), filelist.end(),
std::ostream_iterator<std::string>(buffer, "\n");
SetWindowText(EditShow,buffer.str().c_str());
关于c++ - 将 vector 字符串的值传递给 C++ 中的 win32 函数 SetWindowText,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5309296/