Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- void check() {
- string text;
- ifstream file;
- file.open("test.txt");
- getline(file, text);
- if (text == "") {
- cout << "There's no data in file" << endl;
- }
- else {
- cout << "File contains:" << endl;
- cout << text << endl;
- }
- }
- void masokslur() {
- std::ofstream outfile;
- string a = "kuy nambah yuk";
- string text;
- getline(cin, text);
- outfile.open("test.txt", std::ios_base::app);//std::ios_base::app
- outfile << "\n"+text+"\n";
- //getline(cin, text);
- //cin >> text;
- //outfile << text;
- //return 0;
- }
- int main() {
- check();
- std::ofstream outfile;
- std::ifstream asolololo;
- string text;
- ofstream file;
- asolololo.open("test.txt");
- //file.open("test.txt");
- //masokslur();
- cout << "Type some text" << endl;
- ////getline(cin, text);
- //file << text;
- masokslur();
- //outfile.open("test.txt", std::ios_base::app);
- //outfile << "" + text;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement