Page 133 - DCAP507_SYSTEM_SOFTWARE
P. 133

Unit 9: Design of an Absolute Loader




          fprintf(fp2,"%c%c",input[4],input[5]);                                                Notes
          check();
          fscanf(fp1,"%s",input);
          }
          else
          {
          fprintf(fp2,"%c%c",input[0],input[1]);
          check();
          fprintf(fp2,"%c%c",input[2],input[3]);
          check();
          fprintf(fp2,"%c%c",input[4],input[5]);
          check();
          fscanf(fp1,"%s",input);
          }
          }
          fprintf(fp2,"\n-------------------\n");
          fcloseall();
          printf("\n\n  The  contents  of  output  file:\n\n");
          fp2=fopen("OUTPUT.DAT","r");
          ch2=fgetc(fp2);
          while(ch2!=EOF)
          {
          printf("%c",ch2);
          ch2=fgetc(fp2);
          }
          fcloseall();
          getch();
          }
          void  check()
          {
          count++;
          address++;
          taddr=taddr+1;
          if(count==4)
          {
          fprintf(fp2,"    ");
          i++;
          if(i==4)
          {
          fprintf(fp2,"\n\n%x\t\t",taddr);




                                           LOVELY PROFESSIONAL UNIVERSITY                                   127
   128   129   130   131   132   133   134   135   136   137   138