gpt4 book ai didi

c++ - 将 vector 字符串的值传递给 C++ 中的 win32 函数 SetWindowText

转载 作者:太空宇宙 更新时间:2023-11-04 15:52:45 34 4
gpt4 key购买 nike

如何将 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/

34 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com