If you’re willing to lose almost all portability, I think you could read a value from an I/O port, pass that to
printf, use that as the field width for a string to print, count the character length of the resulting string using %n to move it into a variable, and then backspace over that to prevent the output from dirtying your output. You could only use the results in a subsequent call to
printf, though.
Of course, just hiding an assignment in a printf argument would be much easier, but wouldn’t be fun.
Of course, that would lose lots and lots of portability, and you could, likely, only get it to work on systems that don’t do memory protection between processes, and then, not all of them.
I guess it would not be very hard to use this trick to have printf read joysticks on many micro’s from the 1980’s.