Why the function fputs and fprintf return flow

I do not understand why fputs and fprintf are reverse flow.

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 knew fprintf to put the stream forward to support variable arguments, but why don't the fputs series support sequence ???

+7
c printf fputs
source share
1 answer

Since these things were written many decades ago, this is usually of interest only to historians :-)

It was probably just a design decision (or lack of a solution) that called them that way, and since the meaning of ISO backward compatibility did not change, they never changed it.

It may be that puts was written first, and when it came time to write fputs , the developer simply cut it off by clicking on the new parameter at the end. Even if the same situation existed for printf/fprintf , this would not be possible due to the need for a list of variable arguments to be at the end.

But, an assumption aside, now that our beloved Dennis is gone, we may never know the real reasons.

+6
source share

All Articles