0

How to read commas from a file

Streams

9th Nov 2018, 11:20 PM
Lincoln
2 Antworten
+ 2
#include <iostream> #include <fstream> using namespace std; int main () { string line; ifstream myfile ("example.txt"); if (myfile.is_open()) { while ( getline (myfile,line) ) { cout << line << '\n'; } myfile.close(); } else cout << "Unable to open file"; return 0; }
9th Nov 2018, 11:43 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
Thanks
9th Nov 2018, 11:44 PM
Lincoln