I have found this code here on forum, it works fine but I have no clue how it works, why it work. Can someone tell me a few words about this code please? I would like to understant it and know how to use it. Or if you know some better way, how to input data into bin. file from txt file, can you give me some advice please?
#include <stdio.h>
#define BLOCK_SIZE 256
int main(void)
{
char buf[BLOCK_SIZE];
size_t bytes;
while(!feof(stdin)) {
bytes = fread(buf, 1, BLOCK_SIZE, stdin);
fwrite(buf, 1, bytes, stdout);
}
return 0;
}
Thank you very much.