#include <iostream>
#include <string>
#include "fstream"
using namespace std;
int main(){
string label_file = "/home/wwh/Documents/caffe_files/resnet-18/labels.txt";
std::ifstream labels(label_file.c_str());
if(!labels.is_open()){
cout<<"Can't open the label file!"<<endl;
return -1;
}
string line;
while(std::getline(labels, line)){
cout<<line<<endl;
}
return 0;
}
C++ 实现读取文本文件(按行读取)
最新推荐文章于 2024-05-23 10:13:45 发布