Read file line by line using ifstream in C++ - Stack Overflow

PHOTO EMBED

Wed Dec 01 2021 16:16:13 GMT+0000 (Coordinated Universal Time)

Saved by @Adam101 #cpp

#include <fstream>

std::ifstream file(FILENAME);
if (file.is_open()) {
    std::string line;
    while (std::getline(file, line)) {
        // using printf() in all tests for consistency
        printf("%s", line.c_str());
    }
    file.close();
}
content_copyCOPY

reading from file

https://stackoverflow.com/questions/7868936/read-file-line-by-line-using-ifstream-in-c