It was planned that this part of the code will open the file, enumerate and output its contents in rows, but in fact the entire contents of the file are output to the console at once. According to the description on the site http://www.cplusplus.com/reference/istream/istream/get/ in this case, get () should read before the newline character. What is the problem?
std::ifstream is; is.open(file.txt); std::streambuf *buf = is.rdbuf(); do { is.get(*buf,'\n'); cout<<i<<". "<<buf<<"\n"; }while(is.eof());