// // Created by gfuse on 04/06/22. // #ifndef P_46_TANGUNT_BUG_OBSTACLE_AVOIDANCE_READ_HPP #define P_46_TANGUNT_BUG_OBSTACLE_AVOIDANCE_READ_HPP #include #include #include template class DATA_FILE { public: DATA_FILE(std::string path){ in_ =fopen(path.c_str(),"r+"); assert(in_ && "path is empty in DATA_FILE. Please notice you need to specify the path from project directory like /data/data.txt"); /* out_=fopen("/result.txt").c_str(),"w+"); assert(out_ && "path is empty in DATA_FILE"); chmod((std::string(getenv("HOME"))+"/result.txt").c_str(), ACCESSPERMS);*/ }; ~DATA_FILE(){ fclose(in_); // fclose(out_); }; bool read(std::array& in){ double count=0; if(fscanf(in_,"%le",&count)<1)return false; for(int i=0;i& out){ fprintf(out_,"%ld,",count); for(int i=0;i& out,T& error){ fprintf(out_,"%ld,",count); for(int i=0;i