Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. int main(){
  4.  
  5.     FILE *plik;
  6.     int n, i;
  7.     char nazwa_pliki[20];
  8.     char buffer[255];
  9.  
  10.     printf("Podaj liczbe plikw do wczytania: ");
  11.     scanf("%d", &n);
  12.  
  13.  
  14.     for(i = 0; i < n; i++){
  15.  
  16.         printf("Podaj nazwe pliku do wczytania: ");
  17.         scanf("%s", nazwa_pliki);
  18.         plik = fopen(nazwa_pliki,"r");
  19.         if(plik == NULL){
  20.             printf("ERROR: Prawdopodobnie wpisales zla nazwe pliku.");
  21.             return 1;
  22.         }
  23.         fgets(buffer, 255, plik);
  24.         plik = fopen("wyjscie.txt","a");
  25.         fputs(buffer, plik);
  26.     }
  27.  
  28.     fclose(plik);
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement