Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- using namespace std;
- int main()
- {
- string imie = "Piotr";
- string nazwisko = "Jurek";
- string wiek = "18 lat";
- string tekst;
- ofstream zapis("plik.txt");
- ifstream odczyt("plik.txt");
- if(zapis.is_open() && odczyt.is_open())
- {
- zapis << imie << " " << nazwisko << " " << wiek << endl;
- odczyt.seekg(imie.length(),ios::beg);
- getline(odczyt, tekst);
- cout << tekst;
- }
- else
- {
- cout << "Blad odczytu pliku.";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement