#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(); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter