[求助]字符串怎样转化为字符数组
vector里面是一行一行的字符串,现在要一行一行读出来转化成字符数组,该怎么解决?
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
using namespace std;
int main() {
vector<string> v;
ifstream in ("ttt.txt");
string line;
while (getline(in, line)) {
v.push_back(line);
}
char str[] = v[0].c_str; 这一行会报错cannot convert from '' to 'char []'
cin.get();
}
也试过用char str = v[0].get();把他放在循环里,但是还是有错'get' : is not a member of 'basic_string<char,struct std::char_traits<char>,class std::allocator<char> >'
请大家帮忙给看看