C
cinsky
Hi,
While reading ISO C Standard, I found follow text in 7.19.8.1:
size_t fread(void *restrict ptr, size_t SIZE, ...)
... For each object, SIZE calls are made to the fgetc function
and the results stored, in the order read, in an array of
unsigned char exactly overlaying the object.
My question is, should any fread() implementation call fgetc()?
Why not getc()? The standard says that getc() might be implemented
in macros. So I think fread() should prefer getc() over fgetc().
Actually, I wonder why Standard mention fgetc() to explain fread()
in the first place. In my opinion, it is enough to say that "read
a character" than "call fgetc()...". No?
If I misunderstood something, please let me know.
Regards,
While reading ISO C Standard, I found follow text in 7.19.8.1:
size_t fread(void *restrict ptr, size_t SIZE, ...)
... For each object, SIZE calls are made to the fgetc function
and the results stored, in the order read, in an array of
unsigned char exactly overlaying the object.
My question is, should any fread() implementation call fgetc()?
Why not getc()? The standard says that getc() might be implemented
in macros. So I think fread() should prefer getc() over fgetc().
Actually, I wonder why Standard mention fgetc() to explain fread()
in the first place. In my opinion, it is enough to say that "read
a character" than "call fgetc()...". No?
If I misunderstood something, please let me know.
Regards,