Subj : printf and color codes
To : Nightfox
From : Digital Man
Date : Mon Jan 21 2013 11:56 pm
Re: printf and color codes
By: Nightfox to Mro on Sun Jan 20 2013 09:50 pm
> Re: printf and color codes
> By: Mro to Nightfox on Sun Jan 20 2013 21:43:04
>
> >> non-printable character subtracts 1 from the field length when the
> >> string is printed out. CTRL-A color codes have this effect when used
> >> with printf.
>
> Mr> i'm pretty sure that's intentional and certainly seems like it should
> Mr> be.
>
> It's not what I would expect. If you specify a field length for printf(),
> it should fill that entire field up to that length. Otherwise, the results
> can be unexpected and ugly. The main uses for specifying a field length
> are to align text and filling a space when overwriting existing text on the
> screen. I would expect printf() to only count visible/printable characters
> in the length of a string you give it.
That's not how printf (and the related formatting functions) in C work however.
The width modifier to the %s specifier does not specify the number of
"printable" characters, just the number of characters, period (which includes
non-printable characters, like \a, \b, and so on).
digital man
Synchronet "Real Fact" #76:
Rob Swindell still has dozens of BBS-related magazines in his possession.
Norco, CA WX: 65.4�F, 8.0% humidity, 7 mph E wind, 0.00 inches rain/24hrs
---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net