Advertisement
konrada111

Zapisywanie do pliku

Dec 19th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. char tekst[100],nazwa[100];
  2.  
  3. printf("Podaj nazwe pliku jaki chcesz utworzyc z rozszerzeniem .txt\n");
  4. gets_s(nazwa,100);
  5. printf("Podaj tekst ktory chcesz zapisac w pliku\n");
  6. gets_s(tekst, 100);
  7.  
  8.  
  9. FILE *wp;
  10.  
  11. if ((wp = fopen(nazwa, "w")) == NULL) {
  12. printf("Cos poszlo nie tak");
  13. exit(1);
  14.  
  15. }
  16. fprintf(wp,"%s", tekst);
  17. fclose(wp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement