It's not possible to do something like fputs(4, fptOut);
because fputs doesn't like integers. How can I work around this?
Doing fputs("4", fptOut);
is not an option because I'm working with a counter value.
I know 6 years too late but if you really wanted to use fputs
char buf[12], *p = buf + 11;
*p = 0;
for (; n; n /= 10)
*--p = n % 10 + '0';
fputs(p, fptOut);
Should also note this is for educational purpose, you should stick with fprintf
.
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