#include#include #include void read_file(const char* filename){ std::ifstream infile; infile.open(filename); TString line; while (line.ReadLine(infile)){ std::cout << line << std::endl; } infile.close(); } int main(){ read_file("input.txt"); return 0; }
#includeThis example reads from cin (standard input) and outputs each line to the console. The while loop continues until the user inputs an end-of-file (e.g. ctrl+d on Unix systems, ctrl+z on Windows). In conclusion, TString ReadLine is a method provided by the ROOT library, a data analysis software package written in C++. It is used for reading lines from input text files or input streams, as shown in the above code examples.#include void read_from_cin(){ TString line; while (line.ReadLine(std::cin)){ std::cout << line << std::endl; } } int main(){ read_from_cin(); return 0; }