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. unsigned int 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. int i = 0;
  20. fread(block, sizeof(block), BLOCK_SIZE, in);
  21. //Âûâîäèì áëîê â ôàéë out
  22. fwrite(block, sizeof(block), BLOCK_SIZE, out);
  23. }
  24.  
  25. fclose(in);
  26. fclose(out);
  27. }
Runtime error #stdin #stdout #stderr 0s 3224KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
File error