delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/01/16/05:00:46

Message-ID: <34BF2C5E.1B232C07@csun.edu>
Date: Fri, 16 Jan 1998 01:46:06 -0800
From: Ryan Bright <rmb56313 AT csun DOT edu>
MIME-Version: 1.0
Newsgroups: comp.os.msdos.djgpp
Subject: Re: simple question re: conio.h
References: <34BD8993 DOT 35DA AT primenet DOT com>
NNTP-Posting-Host: s253n025.csun.edu
Organization: California State University, Northridge
Lines: 29
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Smith A. Cat wrote:
[snip curses stuff]
> Has anyone got a code fragment that uses conio.h functions to get
> colored text?? When I try to use them I ALWAYS get the default colors in
> effect at the program startup, I can't set the colors!!?? I can set the
> lines to this and that, and I can gotoxy(), but I can't set the
> colors?!?!?
	You are probably trying to combine conio.h functions with stdio.h
functions which really doesn't work.  You should use one or the other. 
In other words, use 'cprintf()', not 'printf()'.  If that's not what
you're doing, then here's a piece of code I just tested--worked fine.

#include <conio.h>

int main(void) {
  int c;
  clrscr();
  for (c = 0; c < 256; c++) {
    textattr(c);
    cprintf("|%3d|", c);
  }
  textattr(7);
  return 0;
}


> Maybe I should just break down and learn to use the Allegro GUI
> routines.
It might be a more elegant solution.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019