How to make the text stand out

R

Robert Smith

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
 
J

Jack Klein

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 where the Linux experts
hang out.

Good luck.
 
C

CBFalconer

Robert said:
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);
 
M

Moonie

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

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

Keith Thompson

Moonie said:
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).
 
M

Moonie

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
 
J

Joona I Palaste

Moonie said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
EmeliaBryc

Latest Threads

Top