speed comparison between fgetc/fputc and fread/fwrite in C

后端 未结 4 1546
借酒劲吻你
借酒劲吻你 2020-12-17 01:08

So(just for fun), i was just trying to write a C code to copy a file. I read around and it seems that all the functions to read from a stream call fgetc() (I ho

4条回答
  •  [愿得一人]
    2020-12-17 01:26

    fread() is not calling fgetc() to read each byte.

    It behaves as if calling fgetc() repeatedly, but it has direct access to the buffer that fgetc() reads from so it can directly copy a larger quantity of data.

提交回复
热议问题