I don't get it why fputs and fprintf reverse stream order.
int fputs (const char * str, FILE * stream);
int fprintf (FILE * stream, const char * format, ...);
ssize_t write(int fd, const void *buf, size_t count);
I known fprintf put stream in forward to support variable arguments,But why fputs series don't keep consistency ???
Because these things were written many decades ago, it's generally only be a question of interest for historians :-)
It was probably just a design decision (or lack of decision) that caused them to be this way and, since ISO value backward compatibility, they've never changed it.
It may be that puts
was written first and, when it came time to write fputs
, the developer simply cut'n'pasted it, tacking the new parameter onto the end. Even if the same situation existed for printf/fprintf
, that wouldn't have been possible due to the need for the variable argument list to be at the end.
But, supposition aside, now that our beloved Dennis is gone, we may never know the actual reasons..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With