C++读取csv文件并给数组赋值的方法

    std::ifstream indata;

    indata.open("D:\\Proj\\QtProj\\calculate\\output\\jointout74.csv");

 

    std::string line;

    int lnum = 0;

 

 

    while (std::getline(indata, line))

    {

        ++lnum;

        if (lnum < 3)

            continue;

 

        std::stringstream lineStream(line);

        std::string  cell;

        int i = -2;

        double x,y,z,rx,ry,rz;

        Eigen::VectorXd xyzijk(7);

 

        while (std::getline(lineStream, cell, ','))

        {

            ++i;

            if (i == -1)

                continue;

            xyzijk(i) = std::stod(cell);

            //cout<< xyzijk(i);

        }

        qDebug()<

 

    }

    indata.close();

 

你可能感兴趣的:(QT学习)