我在v [0]中需要的值是在向量v中。如何在c ++中插入insert语句的值部分,我将在连接到unix的putty上运行代码。我尝试过值(" v [0]")。请帮忙!!
vector<string> v;
//cout << "OK";
ifstream input("artist.txt");
while (!input.eof())
{
char ch;
//while (!input.eof())
string sample1;
string sample;
//cout << "OK";
//input >> sample;
//cout << sample;
getline(input, sample, '|');
string fina = sample;
//input >> sample;
//cout << sample << " ";
getline(input, sample1, '\r');
string fin = sample1;
//cout << sample1;
v.push_back(fina);
v.push_back(fin);
//string sample1;
//string sample2;
//cout << " ";
//string sample1;
//getline(input, sample1);
//input >> sample1;
//input >> " ";
//input >> sample2;
//cout << sample1 << " " << sample2 << endl;
//cout << sample1;
//string fin = sample1 + " " + sample2;
//cout << fin;
//cout << fina1;
//v.push_back(fina1);
//input >> sample1;
//cout << sample1;
//v.push_back(sample1);
//cout << sample1;
//cout << endl;
//cout << v[0] << endl << v[1];
//cout << vi[0] << vi[1];
//v.push_back(fin);
//input.seekg(2L, ios::cur);
input.get(ch);
}
cout << v[0] << " " << v[1];
sql1 = "INSERT INTO Artist(name) "
//"VALUES (" + quotesql(v[0]) + "," + quotesql(v[1]) + ");";
"VALUES ("v[1]");";
input.close();
}