-1
我知道这段代码迭代并从文件中获取数据,但我想将每个值存储在它自己的独立字符串中。如何将每个值存储在字符串中?
int getHosts()
{
system("clear");
GfdOogleTech gfd;
string data = gfd.GetFileContents("./vhosts.a2m");
size_t cPos = 0
string currentValue;
while(currentValue.assign(gfd.rawParse(data, "|", "|", &cPos)) != blank)
{
cout << currentValue << endl;
}
system("sleep 5");
return 0;
}
上面的代码输出以下值:
- crativetech.me.conf
- www.creativetech.me
- [email protected]
- /网络/ creativetech/www
如何存储每个上述的值在它自己的字符串?
只需声明一个std :: vector之前的while循环和pushback currentValue就可以了吗?除非我错过了一些非常明显的东西:S –
FailedDev