SHARE
TWEET

Untitled

Daniel_HD Oct 22nd, 2019 76 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define N 20
  4.  
  5. typedef struct{
  6.     char code[N];
  7.     char original[N];
  8. } dict;
  9.  
  10. int dict_reader(FILE *fp_dict);
  11. void file_recoder(FILE *fp_src, FILE *fp_code);
  12.  
  13. int main()
  14. {
  15.     int word_num;
  16.     FILE *fp_dict, *fp_src, *fp_code;
  17.  
  18.     fp_dict = fopen("dizionario.txt", "r");
  19.     fp_src = fopen("sorgente.txt", "r");
  20.     fp_code = fopen("ricodificato.txt", "w");
  21.  
  22.     word_num = dict_reader(fp_dict);
  23.     file_recoder(fp_src, fp_code);
  24.  
  25.     fclose(fp_dict);
  26.     fclose(fp_src);
  27.     fclose(fp_code);
  28.  
  29.     return 0;
  30. }
  31.  
  32. int dict_reader(FILE *fp_dict){
  33.  
  34.     int num, i;
  35.  
  36.     fscanf(fp_dict, "%d", &num);
  37.  
  38.     while(fscanf(fp_dict, "%s %s\n", dict[i].code, dict[i].original) != EOF){
  39.         i++;
  40.     }
  41.  
  42.     return num;
  43. }
  44.  
  45. void file_recoder(FILE *fp_src, FILE *fp_code){
  46.  
  47.  
  48.  
  49.     return;
  50. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top