c++ read
#include <fstream> #include <iostream> int main(void) { char url[1000] = {0}; int buff_len = 1000; std::ifstream read("./urls"); if (!read) { // 这跟python语法相似啊 std::cout << "open file err!" << std::endl; return -1; } while( !(read.peek() == EOF) ) { read.getline(url, buff_len); std::cout << url << std::endl; } read.close(); }