[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1122
  • Last Modified:

how to write underlined text in c++?

Hello i want to write a underlined heading at the begining of the program . How can i do that ?
0
emreayman
Asked:
emreayman
1 Solution
 
ozoCommented:
On what kind of output device?
Is it a VT100 compatble display?   A HTML browswer?
0
 
emreaymanAuthor Commented:
it is win32 app.  (DOS)
0
 
emreaymanAuthor Commented:
cout << "WELCOME";

how can i write this underlined.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
ozoCommented:
If you load
device=c:\windows\command\ansi.sys
in your CONFIG.SYS file, then you should be able to
cout << "\033[4mWELCOME\033[0m";
0
 
emreaymanAuthor Commented:
Is there another way ?.it's a console application .
0
 
NickGeorghiouCommented:

cout << "WELCOME" << endl;
cout << "------------" << endl;

:-)

sorry, just trying to be funny...
0
 
emreaymanAuthor Commented:
thank you ozo and NickGeorghio :)  . ozo i added this line device=c:\windows\command\ansi.sys  in command.com and tried with your code but it didn't work . Let's say it works If i run it under another computer that ansi.sys not loaded it's not going to show text underlined right? . Is there a another simple method (I'm writing my program in Visual C++)
0
 
itsmeandnobodyelseCommented:
>>>> Is there a another simple method (I'm writing my program in Visual C++)

The problem is not in C++ but in the console. A console output cannot be underlined beside you would find a console font where each character already includes a '_' (visually).

What you can do in a Win32 console is to write text in different colors. Maybe you can substitute the underlining by using an appropriate coloring. To see the possibilities you should load the CONSOLE sample from MSDN_LIB. You'll find a link to that sample in MSDN by the title 'Console sample (console functions)' .

Regards, Alex
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now