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