fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4.  
  5.  
  6. int main(void){
  7. FILE *in;
  8. FILE *out;
  9. const unsigned int BLOCK_SIZE = 3;
  10. char block[BLOCK_SIZE];
  11.  
  12. in = fopen("input.txt", "rt");
  13. if(in == NULL){ fputs("File error", stderr); return 1; }
  14.  
  15. out = fopen("output.txt", "wt");
  16. if(out == NULL){ fputs("File error", stderr); return 1; }
  17.  
  18. while(!feof(in)){
  19. memset(block, 0, sizeof(block));
  20. if(fread(block, sizeof(char), BLOCK_SIZE, in) != 0){
  21. fwrite(block, sizeof(char), BLOCK_SIZE, out);
  22.  
  23. //!!!!!!!!
  24. for(int i = 0; i < BLOCK_SIZE; i++){
  25. printf("%d", block[i]);
  26. printf(" ");
  27. }
  28. printf("\n");
  29.  
  30. int mark = 0;
  31. for(int i = 0; i < BLOCK_SIZE; i++){
  32. mark += block[i]*((int)pow(255.0, (BLOCK_SIZE - 1 - i)*1.0));
  33. }
  34. printf("%d", mark);
  35. printf("\n");
  36. }
  37. }
  38.  
  39. fclose(in);
  40. fclose(out);
  41.  
  42. int p = 0;
  43. scanf("%d", p);
  44. }
Runtime error #stdin #stdout #stderr 0s 3224KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
File error