ifstream是操作文件的输入流类。
创建一个读取文件的fAssociation对象。
ifstream::open的声明为:
void open (const char* filename, ios_base::openmode mode = ios_base::in);
需要一个char *型的指针,strAssociationFilename.c_str()的作用是转换为一个和C语言类似的字符串类型。
如果文件为空,则fAssociation.eof()返回为true,循环结束。
getline(fAssociation,s);的作用是从fAssociation文件流中获取一行数据赋值给string类的对象s。
接着按照顺序依次对时间t,RGB图sRGB,Depth图sD赋值。
同时将其push入对应的容器中。
void LoadImages(const string &strAssociationFilename, vector<string> &vstrImageFilenamesRGB,
vector<string> &vstrImageFilenamesD, vector<double> &vTimestamps)
{
ifstream fAssociation;
fAssociation.open(strAssociationFilename.c_str());