Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <conio.h>
- int main ()
- {
- FILE *fp; //
- char tekst[15];
- printf("Co chcesz zapisac do pliku: \n");
- fgets(tekst,15,stdin);
- if ((fp=fopen("test.txt", "w"))==NULL) {
- printf ("Nie mogę otworzyć pliku test.txt do zapisu!\n");
- exit(1);
- }
- fprintf (fp, "%s", tekst); /* zapisz nasz łańcuch w pliku */
- fclose (fp); /* zamknij plik */
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment