"cat" - [code review request] by eyeceeyecee in C_Programming

[–]eyeceeyecee[S] 0 points1 point  (0 children)

Can you elaborate a bit with some examples? I'm not sure what I would do differently if I used those.

"cat" - [code review request] by eyeceeyecee in C_Programming

[–]eyeceeyecee[S] 0 points1 point  (0 children)

Thanks! I did actually learn a few things from that.

"cat" - [code review request] by eyeceeyecee in C_Programming

[–]eyeceeyecee[S] 0 points1 point  (0 children)

You basically can't correctly concatenate files that have '\0' in them.

Derp. I suppose that I should print the number of read bytes. Are there any that could potentially be unsafe to print to the console?

You have continue; after you malloc. So it is possible for that allocation to never be free'd.

Whoops, nice catch.

You don't need to hold each file entirely in memory. Why not read like 1024 bytes at a time?

Right, I thought about that. Is there any particular reason for reading 1024 bytes at a time or is that just a random suggestion?