printing underlined text

Gary Weimer weimer at ssd.kodak.com
Tue Nov 13 05:32:13 AEST 1990


In article <1990Nov11.153636.13643 at mp.cs.niu.edu> rickert at mp.cs.niu.edu (Neil Rickert) writes:
>In article <8611 at fmeed1.UUCP> russ at m-net.ann-arbor.mi.us (Russ Cage) writes:
>>In article <43321 at eerie.acsu.Buffalo.EDU> haozhou at acsu.buffalo.edu (hao zhou) writes:
>>>Does anybody out there know if it's possible to print out underlined
>>>text using printf() in C? And how? 
>>
>>This really belongs in comp.lang.c, but...
>>
>>printf( "Underlined text\015__________ ____\n" );
>>
>>ought to work on any ASCII system with printing terminals.
>>To use underlining on CRTs or other fancy equipment you
>>have to get hardware-specific (or use termcap).
>>
>
> One improvement would be to use:
>
>printf( "__________ ____\015Underlined text\n" );
>
> That way, on a CRT you would at least see the text instead of the
>underscores.

Another improvement:

printf( "_^HU_^Hn_^Hd_^He_^Hr_^Hl_^Hi_^Hn_^He_^Hd _^Ht_^He_^Hx_^Ht\n" );

Although this is much less readable, most "smart" terminals, as well as
printers will know how to handle this (see nroff output).

Gary Weimer



More information about the Comp.lang.c mailing list