Color Output
Aug 23, 2013 at 4:27am UTC
Hello, I need help with colors I looked at other color pages but I couldn't find anything like what I need... Right now it writes Hello and ! In red the name in black (on black background...) what I. Want is to change the background...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
#include <stdio.h>
#define BLACK "\033[22;30m"
#define GREEN "\033[22;31m"
void help();
void stupid();
void version();
int main(int argc, char * argv[])
{
if (argc!=2)
{
stupid();
return 1;
}
if (argv[1][0]=='-' )
{
switch (argv[1][1])
{
case 'h' :
help();
break ;
case 'v' :
version();
break ;
case 'e' :
return 1;
default :
stupid();
return 1;
}
}
else
{
printf( GREEN "Hello, " );
printf(argv[1]);
printf( GREEN "!\n" );
printf(BLACK);
}
return 0;
}
void help()
{
printf("Usage:\n./hello [NAME] [-hv]\n" );
printf("\t-h\tHelp\n" );
printf("\t-v\tVersion\n" );
}
void stupid()
{
printf("STUPID!\n" );
printf("TYPE THE NAME OF THE PROGRAM THEN YOUR NAME.\n" );
printf("IT ISN'T COMPLICATED!\n" );
}
void version()
{
printf("Hello (C) 2013 Tim Palmer\n" );
printf("Version: 0.0.2\n" );
}
I also need help with moving the cursor around...
Last edited on Aug 23, 2013 at 7:06am UTC
Aug 23, 2013 at 11:36am UTC
Search for ncurses. There are many examples on the web.
Aug 24, 2013 at 1:58am UTC
I would but I'm on an android linux you know like nostly linux but I can't get things like that...
Topic archived. No new replies allowed.