C03601DM%WUVMD.BITNET@cornellc.ccs.cornell.edu (Derek Morgan) (05/26/88)
Has anybody gotten printf,(c-,v-,-f) to produce colors inside of MSC 5.0? I can get color text by using _outtext, but _outtext doesn't have formatting capabilities. To use ANSI.SYS is cheating, because not everybody has DEVICE= ANSI.SYS in their config.sys file. Thanks, Derek Morgan Every time I get an answer to a question in C, the answer causes 20 more questions...
daveb@laidbak.UUCP (Dave Burton) (05/26/88)
In article <14608@brl-adm.ARPA> C03601DM%WUVMD.BITNET@cornellc.ccs.cornell.edu (Derek Morgan) writes: |Has anybody gotten printf,(c-,v-,-f) to produce colors inside of MSC 5.0? I |can get color text by using _outtext, but _outtext doesn't have formatting |capabilities. To use ANSI.SYS is cheating, because not everybody has DEVICE= |ANSI.SYS in their config.sys file. Nocando. Printf() as implemented by MS uses DOS calls to allow I/O redirection. The DOS interrupt functions will eventually use a BIOS call 'wrtty' I think (int 0x10, func 0x14?). Anyway, allowing color info in the stream would hinder the usefulness of redirection. You may want to use sprintf() first, then use _outtext() to dump it in color. If you could devise a decent enough parameter list, perhaps even write a wrapper printf that did what you wanted. I once wrote a high-performance PC screen management library, but used MASM for the lowest level (replacing the BIOS routines). The first motivation for this was because I couldn't get printf() to output color info. The second motivation was because printf() (in MSC4.0) was slooooow. As for portability, I only cared about true blue and 100% compatibles. You may also want to do the same, depending upon your circumstances.
brian@bradley.UUCP (05/28/88)
> /* 7:54 pm May 25, 1988 by C03601DM%WUVMD.B@cornellc.ccs.cornell.edu */ > /* ---------- "Color in MSC using *printf?" ---------- */ > Has anybody gotten printf,(c-,v-,-f) to produce colors inside of MSC 5.0? I > can get color text by using _outtext, but _outtext doesn't have formatting > capabilities. To use ANSI.SYS is cheating, because not everybody has DEVICE= > ANSI.SYS in their config.sys file. We have a function that sends a string to the screen: void send(y, x, a, s) unsigned y, x; /* position */ unsigned a; /* color */ char *s; /* string */ I assume this is similar to what _outtext() does. To send a formatted string to the screen, we use something like: int w_printf(y, x, a, fmt, ...) unsigned y, x; unsigned a; char *fmt; { static char buf[512]; va_list arg_ptr; int nc; va_start(arg_ptr, &fmt); nc = vsprintf(buf, arg_ptr); va_end(arg_ptr); send(y, x, a, buf); return(nc); } ............................................................................... When the going gets weird, the weird turn pro. Brian Michael Wendt UUCP: {cepu,ihnp4,uiucdcs,noao}!bradley!brian Bradley University ARPA: cepu!bradley!brian@seas.ucla.edu (309) 677-2230 ICBM: 40 40' N 89 34' W