Tuesday, July 3, 2012

New Color Print for C/C++ DOS/Unix

No need of cprintf(...), no need of textmode(), textcolor(), textbackground().. Just print it as a string usin formatted character (%s). I'll give you examples.

Example Code :




#ifndef __LINUX__
#include"myconio.h"
#else
#include"console/console.h"
#include<conio.h>
#endif
#include<stdio.h>

void main (void)
  {
    clrscr();
    printf("%s%s%s%s Hello World%s",FG_RED,BG_BLUE,SET_BLINK_ON, BOLD,DEFAULT);
    getch();
 }

***  "myconio.h" can be referred from here.
If you find error or any doubts, be free for commenting them.

No comments:

Post a Comment