0

Working on Files

I've learnt working on files with c++ and now I know how to modify a text file .txt and write something in it..but can I make a code that read a text file and prints the words in the text file on console application?? I'm a beginner :)

21st Dec 2016, 1:32 AM
Fluffy Rabbit
Fluffy Rabbit - avatar
2 Respostas
+ 2
Yes you can. But if you've learnt with SoloLearn c++ curses, you may not see it is located at the end of the file section ( second part ) who's cover writing :P : #include <iostream> #include <fstream> using namespace std; int main() { string line; ifstream MyFile("test.txt"); while (getline(MyFile,line)) { cout << line << '\n'; } }
21st Dec 2016, 2:20 AM
visph
visph - avatar
0
Oh I didn't notice that..THANKS!
21st Dec 2016, 3:05 AM
Fluffy Rabbit
Fluffy Rabbit - avatar