473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to make the text stand out

I am programming C in linux and i just need a quick and dirty way to make
some text stand out. I would like to change the color maybe to red. I want
to print out something like
printf("Blah: This is my message.");
Blah: This is my message.

I would like blah to be red.
if not red than maybe bold or some way for it to stand out.
thanks
Nov 14 '05 #1
6 1932
On Mon, 06 Sep 2004 01:45:22 GMT, "Robert Smith" <no**@none.com> wrote
in comp.lang.c:
I am programming C in linux and i just need a quick and dirty way to make
some text stand out. I would like to change the color maybe to red. I want
to print out something like
printf("Blah: This is my message.");
Blah: This is my message.

I would like blah to be red.
if not red than maybe bold or some way for it to stand out.
thanks


Standard C does not even require that stdout be connected to a video
display device, so it has absolutely no support at all for formatting
the text in any way.

There are platform-specific extensions for just about all platforms
that support this, but these are not part of the language and are not
discussed here.

For Linux, you need to ask about the extensions available to you in
the group news:comp.os.linux.development.apps, where the Linux experts
hang out.

Good luck.

--
Jack Klein
Home: http://JK-Technology.Com
FAQs for
comp.lang.c http://www.eskimo.com/~scs/C-faq/top.html
comp.lang.c++ http://www.parashift.com/c++-faq-lite/
alt.comp.lang.learn.c-c++
http://www.contrib.andrew.cmu.edu/~a...FAQ-acllc.html
Nov 14 '05 #2
Robert Smith wrote:

I am programming C in linux and i just need a quick and dirty way
to make some text stand out. I would like to change the color
maybe to red. I want to print out something like
printf("Blah: This is my message.");
Blah: This is my message.

I would like blah to be red.
if not red than maybe bold or some way for it to stand out.


printf("BLAH: This is my message."); fflush(stdout);

--
"I'm a war president. I make decisions here in the Oval Office
in foreign policy matters with war on my mind." - Bush.
"If I knew then what I know today, I would still have invaded
Iraq. It was the right decision" - G.W. Bush, 2004-08-02

Nov 14 '05 #3

printf("\033[0;color+30;color+40;13m"

enum colors { BLACK=0, RED, GREEN, YELLOW, BLUE, MAGNETA, CYAN, WHITE
};

--
Moonie
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 14 '05 #4
Moonie <Mo***********@mail.codecomments.com> writes:
printf("\033[0;color+30;color+40;13m"

enum colors { BLACK=0, RED, GREEN, YELLOW, BLUE, MAGNETA, CYAN, WHITE
};


What?

The substring "color+30" doesn't expand to the value of the expression
in a string literal. Even if the code were correct, it would be
non-portable; there is no portable way to make text stand out (OTHER
THAN TRICKS LIKE THIS).

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #5

ansi protocols do work under linux and unix

instead of color use BLACK or RED

BLACK+30 and so forth...

you can use ncurses if you wish
-
Mooni
-----------------------------------------------------------------------
Posted via http://www.codecomments.co
-----------------------------------------------------------------------

Nov 14 '05 #6
Moonie <Mo***********@mail.codecomments.com> scribbled the following:
ansi protocols do work under linux and unix instead of color use BLACK or RED BLACK+30 and so forth... you can use ncurses if you wish.


This may come as a shock to you, but Linux and Unix are not the whole
world. C is even available for applications that don't use visual output
at all, and thus have no concept of "colour". If you want to give Unix-
specific advice, there's always comp.unix.programmer.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-- http://www.helsinki.fi/~palaste --------------------- rules! --------/
"This isn't right. This isn't even wrong."
- Wolfgang Pauli
Nov 14 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Steven T. Hatton | last post by:
This is something I've been looking at because it is central to a currently broken part of the KDevelop new application wizard. I'm not complaining about it being broken, It's a CVS images. ...
4
by: Peter Scott | last post by:
I created a table that has a column in that needs to contain a full Unix file path. Since 2048 was too long for a VARCHAR, I made it TEXT. I since populated the table. Now I want to make the...
7
by: Blankdraw | last post by:
The following 2 code segs seem to be the cause of my output infinite loop. Can someone tell me if this is wrong? I'd like to post the entire program, but that seems to distract everyone who migh...
6
by: Lance Geeck | last post by:
I have a simple form where I am using a dataset called Client. On the data entry screen, there are name, address, city state and zip. I have the fields bound to the dataset field. (Properties...
1
by: ahmad | last post by:
I want to make a particular option's text bold within a list in html, while all other options will get their normal font-weight, How can i do this???????? i tried <b>, <font> tags and style and...
6
by: Ian Boyd | last post by:
Every time during development we had to make table changes, we use Control Center. Most of the time, Control Center fails. If you try to "undo all", it doesn't, and you end up losing your identity...
1
by: xahlee | last post by:
Elisp Tutorial: Make Google Earth Xah Lee, 2006-12 This page shows a example of writing a emacs lisp function that creates a Google Earth file, and creates a link to the file, as well a link...
6
by: portCo | last post by:
Hello there, I am creating a vb application which is some like like a questionare. Application read a text file which contains many questions and display one question and the input is needed...
9
by: GloStix | last post by:
Okay, when I click the link it dissapears and makes a white space underneath it but the space is clickable. so when you click the space, the link actually works Used Firefox 3.0 RC2 for this. OS X...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.