c++ 读取txt文件

void Load_GPS(const std::string gps_path, std::map<std::string, cv::Point3d> &all_gps_data)
{
    std::ifstream ifs;
    ifs.open(gps_path);
    if (!ifs.is_open())
    {
        std::cerr << "Can not open gps.txt!" << std::endl;
        exit(-1);
    }
    while (!ifs.eof())
    {
        std::string image_name;
        cv::Point3d temp_gps;
        ifs >> image_name >> std::setprecision(12) >> temp_gps.x >> temp_gps.y >> temp_gps.z;
        all_gps_data[image_name] = temp_gps;
    }
}

 

上一篇:C++文件的随机读写


下一篇:PHP命令执行