Solved

how to write underlined text in c++?

Posted on 2006-11-13
10
494 Views
Last Modified: 2012-06-21
Hello i want to write a underlined heading at the begining of the program . How can i do that ?
0
Comment
Question by:emreayman
10 Comments
 
LVL 84

Expert Comment

by:ozo
Comment Utility
On what kind of output device?
Is it a VT100 compatble display?   A HTML browswer?
0
 

Author Comment

by:emreayman
Comment Utility
it is win32 app.  (DOS)
0
 

Author Comment

by:emreayman
Comment Utility
cout << "WELCOME";

how can i write this underlined.
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Author Comment

by:emreayman
Comment Utility
Is there another way ?.it's a console application .
0
 
LVL 84

Expert Comment

by:ozo
Comment Utility
0
 
LVL 5

Expert Comment

by:NickGeorghiou
Comment Utility

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

:-)

sorry, just trying to be funny...
0
 

Author Comment

by:emreayman
Comment Utility
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
 
LVL 39

Accepted Solution

by:
itsmeandnobodyelse earned 125 total points
Comment Utility
>>>> 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Often, when implementing a feature, you won't know how certain events should be handled at the point where they occur and you'd rather defer to the user of your function or class. For example, a XML parser will extract a tag from the source code, wh…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now