LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-20-2003, 03:54 PM   #1
TriggerJ
LQ Newbie
 
Registered: Sep 2003
Location: Texas
Posts: 14

Rep: Reputation: 0
Bolding in C++


Would anyone know how I would bold the first letter of a word in C++?

Thanks,

J-
 
Old 09-20-2003, 04:17 PM   #2
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
sorry, that doesnt really make much sense, can you rephrase or say what your actually trying to do
 
Old 09-20-2003, 04:21 PM   #3
TriggerJ
LQ Newbie
 
Registered: Sep 2003
Location: Texas
Posts: 14

Original Poster
Rep: Reputation: 0
I want to make the first letter of a word to be bold.

Ex: Help
 
Old 09-20-2003, 04:44 PM   #4
kev82
Senior Member
 
Registered: Apr 2003
Location: Lancaster, England
Distribution: Debian Etch, OS X 10.4
Posts: 1,263

Rep: Reputation: 51
i understood your question, the fact is it doesnt make sense, c++ deals in plain text or binary, you would have to use an external graphics library to make it output anything like that.

if you can give me a clue as to what you want like "i want to input plain text and ouput html/TeX with the first letter of each word bolded" or "i want to open up a window that displays the contents of a text file with the first letter of each word in bold" then maybe i can help but just asking "how to bold the first letter of each word" makes no sense in this context.
 
Old 09-21-2003, 12:36 AM   #5
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
It is possible to bold characters using the ncurses library.
 
Old 09-21-2003, 10:11 AM   #6
coolman0stress
Member
 
Registered: Jun 2003
Location: Toronto, Ontario, Canada
Posts: 288

Rep: Reputation: 30
Like kev82 mentioned, you need to tell us what output format you're dealing with. Is it console, plain text (and other files), windows, html, etc?
 
Old 09-21-2003, 10:28 AM   #7
TriggerJ
LQ Newbie
 
Registered: Sep 2003
Location: Texas
Posts: 14

Original Poster
Rep: Reputation: 0
It's a console application. Not sure if that helps...

Jessica
 
Old 09-21-2003, 01:00 PM   #8
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
why dont you use escape sequences for colour higlighting on terminals,

#include <iostream.h>

int main ()
{

cout<<"\033[01;37m";
cout<<"the bold text:\n";
cout<<"\033[0m";

return 0;

}


this program prints the line in white..emboldened...

hope this has been of some help...

here are some color codes you might like to use:
black 0;30
green 0;32
red 0;31
brown 0;33
dark grey 1;31
light green 1;32
light red 1;31
yellow 1;33
blue 0;34
cyan 0;36
purple 0;35
light gray 0;37
light blue 1;34
light cyan 1;36
light purple 1;35
white 1;37

Last edited by shishir; 09-21-2003 at 01:10 PM.
 
Old 09-21-2003, 02:17 PM   #9
TriggerJ
LQ Newbie
 
Registered: Sep 2003
Location: Texas
Posts: 14

Original Poster
Rep: Reputation: 0
Awesome...thanks bunches.

Jessica
 
Old 09-21-2003, 04:07 PM   #10
jinksys
Member
 
Registered: Aug 2003
Location: 63123
Distribution: OpenSuSE/Ubuntu
Posts: 419

Rep: Reputation: 35
It would be much better to implement this program using ncurses than escape sequences that may or may work with the given terminal. I will post a sample program when i get home.
 
Old 09-22-2003, 12:13 AM   #11
shishir
Member
 
Registered: Jul 2003
Location: bangalore . india
Distribution: openSUSE 10.3
Posts: 251

Rep: Reputation: 33
yeah..agreed it would not work...atleast i dont think it would on VT100, but other than that ..it is working on the terminal that i use...ncurses doesnt sound like a great idea for such a small thing...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration