std::ifstream file_stream1(outfile,std::ifstream::out | std::ifstream::binary);
std::vector<double> file;
std::vector<double> file1;
std :: string line;
while (getline (file_stream1, line))
{
double item[100];
std :: string dataEntry; //a particular entry as a string
std :: istringstream lineStream(line);
for(int i = 0; i < 1; i++)
{
//get one entry
getline( lineStream, dataEntry, ',');
lineStream >> std::ws; //remove whitespace after the comma and before the next entry
std:: istringstream( dataEntry ) >> item[i];
std :: cout << item[i] << std ::endl ;
file.push_back (item[i]);
file1.push_back (item[i]);
}
答案 0 :(得分:0)
你的for循环只有一次迭代,使用:
for(int i = 0; i&lt; = 1; i ++)