trojanxem

Untitled

Mar 1st, 2012
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <conio.h>
  4.  
  5. int main ()
  6. {
  7. FILE *fp; //
  8. char tekst[15];
  9. printf("Co chcesz zapisac do pliku: \n");
  10. fgets(tekst,15,stdin);
  11. if ((fp=fopen("test.txt", "w"))==NULL) {
  12. printf ("Nie mogę otworzyć pliku test.txt do zapisu!\n");
  13. exit(1);
  14. }
  15. fprintf (fp, "%s", tekst); /* zapisz nasz łańcuch w pliku */
  16. fclose (fp); /* zamknij plik */
  17. return 0;
  18.  
  19. }
Advertisement
Add Comment
Please, Sign In to add comment