Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main () {
- FILE *test;
- char tekst[100];
- printf("%s","Podaj swoj string (nie uzywaj spacji)\n",tekst[100]);
- scanf("%s", &tekst);
- if ((test=fopen("test.txt", "w"))==NULL) {
- printf("%s","Nie mogę otworzyć pliku test.txt do zapisu!\n");
- return 0;
- }
- fprintf(test, "%s", tekst);
- fclose(test);
- char x;
- printf("%s","Chcesz wczytac zawartosc pliku(t/n)\n");
- scanf("\n%c",&x);
- if (x=='n')
- {
- printf("%s","ok");
- return 0;
- }
- if (x=='t')
- printf("%s","wczytuje zawartosc pliku..\n");
- if((test=fopen("test.txt", "r"))== NULL) {
- printf ("Nie moge otworzyc pliku test.txt do odczytu!\n");
- return 0;
- }
- fscanf (test, "%s", tekst);
- fclose (test);
- //printf("%s\n", tekst);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement