Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- ofstream Plik;
- string nazwa_pliku;
- cout << "Podaj nazwe pliku, do ktorego chcesz wpisac tekst: ";
- cin >> nazwa_pliku;
- Plik.open(nazwa_pliku.c_str());
- cout << "Podaj tekst, ktory chcesz wpisac do pliku: ";
- string tekst;
- cin.ignore(99999, '\n'); // wyczyszczenie buforu wejścia
- getline(cin, tekst);
- Plik << tekst;
- Plik.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement