J
Joe keane
how many parameters do fputint() and fputdouble() have?
int fputint(FILE *fp, int val, int wid, int opt);
int fputdouble(FILE *fp, double val, int wid, int dp, int opt);
[C++]
try printing a four digit hexadecimal number. Or a double with 3
significant digits. You can do thse things but they're awkward,
When i first saw this wacky crap, i thought 'is this a joke?' and then
'is this someone's idea of good design?'.
But note that all the problems come from assuming that the input/output
functions have two arguments, which is just wrong. For example, i
rarely see a 'double' printed with a bare "%f"; the format is as
important as the value.
And if you write 'fputint' and someone says 'that's decimal! i need
octal!' you say, well here you go:
int fputdecint(...);
int fputoctint(...);
int fputhexint(...);
Or just use the 'opt' thingy i gave above.
The problem is that all the functions are called "<<"; so you have the
type to split on, but that's really not sufficient.