Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <string>
- using namespace std;
- bool wyswietl(string sNazwaPliku )
- {
- ifstream plik;
- plik.open( sNazwaPliku.c_str() );
- if( !plik.good() )
- return false;
- std::string wiersz;
- while( std::getline( plik, wiersz ) )
- std::cout << wiersz << std::endl;
- plik.close();
- return true;
- }
- int main()
- { ofstream plik( "tekst.txt" );
- plik << "tekst pliku";
- plik.close();
- if( !wyswietl( "tekst.txt" ) )
- std::cout << "Nie udalo sie otworzyc pliku o podanej nazwie." << std::endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement