Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- int main()
- {
- ifstream input("C:/Users/musta/Downloads/text.txt");
- string line;
- //if (input.is_open()) или
- if (input)
- {
- while (getline(input, line))
- {
- cout << line << endl;
- }
- cout << "done!" << endl;
- }
- else
- {
- cout << "error!" << endl;
- }
- // (файловые) потоки можно приводить к типу bool и вернут true, если с ними можно работать в данный момент
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement