home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 12 / CD_ASCQ_12_0294.iso / vrac / pclcjs.zip / COLORTX2.C < prev    next >
C/C++ Source or Header  |  1992-12-21  |  999b  |  33 lines

  1. /* colortext2 library function copyright 1991 by Chuck Steenburgh */
  2. /*  This function is identical to colortext except that the
  3.     first character in the string text[] is printed with the
  4.     attribute specified by hilite.  (This is useful in menus
  5.     and other uses when you want to make the first letter of
  6.     a word stand out.)  See file COLORTXM.C
  7.  
  8. #include <bios.h>
  9. #include <string.h>
  10.                                                    */
  11. int colortext2(char *text, int r1, int c1, int color, int hilite, int hpos, max_rows)
  12. {
  13.     /* Local variable */
  14.     int counter;
  15.     
  16.     /* Check for valid arguments */
  17.     if (r1<0 || r1>max_rows || c1<0 || c1>79 || color<0 || color>255 || hilite<0 || hilite>255 || hpos<1 || hpos>strlen(text))
  18.         return 1;
  19.     
  20.     poscurs(r1,c1);
  21.     for (counter=0;counter<strlen(text);counter++) {
  22.         poscurs(r1,c1+counter);
  23.         
  24.         /* Check for highlight character */
  25.         if (counter == hpos-1)
  26.             writechs(text[counter],hilite,1);
  27.         else
  28.             writechs(text[counter],color,1);
  29.     }
  30.     
  31.     return 0;
  32. }
  33.