本文介绍了如何从多个向量数组制作CSV文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
vector <string> CSVWrites;
vector <string> s1; s1[0]="A";
vector <string> s2; s2[0]="B";
vector <string> s3; s3[0]="C";
vector <string> s4; s4[0]="D";
stringstream ss;
ss << s1[0].c_str()<<","<<s2[0].c_str()<<","<<s3[0].c_str()<<","<<s4[0].c_str();
CSVWrites.push_back(ss.str());
我不知道处理这种情况的更好方法,如果有一个向量,则创建CSV文件非常容易.我有100个向量,如果按照上述方式操作,我不确定stringstream是否支持那么多.
示例每个向量数组中的两个元素
A,B,C,D
E,F,G,H
.......
.......
如果您有想法,我将非常感谢您的帮助.
I don''t know the better way to handle this case, if there is one vector, it is very easy to create an CSV file. I have 100 vectors, I am not sure stringstream supports that much if I do as above way.
Example two elements from each vector array
A,B,C,D
E,F,G,H
.......
.......
If you have an idea, I am greatly appreciate for your help.
推荐答案
这篇关于如何从多个向量数组制作CSV文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!