c++ 读取txt文件

时间:2021-09-04 02:57:09   收藏:0   阅读:17
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;
    }
}

 

原文:https://www.cnblogs.com/lockingball/p/15221994.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!