RE: Graphics in Linux using C

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>Hello
>I want to use graphics in C to highlight text in a file.
> Can someone tell me how to use some basic graphic
> functions to acheive this?
> Nimit

It depends how you are going to display the file.  If you are
writing it to a terminal window, there are a set of control 
sequences you can send to the terminal which identify 
limited coloration, including reverse video.

For example:

#include <stdio.h>

int main(int argc, char *argv[])
{
char  escape = 0x1b;
printf("%c[43mthis is a test\nmore test%c[m\n", escape, escape);
printf("%c[7mreverse video%c[mback to normal\n", escape, escape);
}
The sequence is the escape character which is octal 033 or 0x1b, open
square bracket, a code suitable to the termial, and the letter m.
leaving out the number code resets back to normal output.

I think this is what you are looking for.

Bob Styma


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux