Skip to content

Commit 0861e9e

Browse files
authored
Update getline.cpp
1 parent c53f6ef commit 0861e9e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

getline.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,15 @@ int main() {
66
char * napis = new char[128];
77

88
cout<<"Napiz cos: ";
9-
cin.getline(napis, 128);
9+
cin.getline(napis, 128); //zmienna i dlugosc przchwytywanych danych
1010
cout<< napis<<endl;
1111

12+
ofstream zapis;
13+
zapis.open("plik.txt", ofstream::app); //append czyli dopisywnaie nie nadpisywanie
14+
zapis<<napis<<endl;
15+
16+
zapis.close();
17+
delete [] napis;
18+
1219
return 0;
1320
}

0 commit comments

Comments
 (0)