shearer@cis.udel.edu (Rob Shearer) (09/30/90)
Hello! Yet another cryptic question that may sound very weird!
I am interested in making printf (and anything else that would print to
the screen) print to a memory location instead.
I know how to create a variable (I am using TC++ by the way) that
will let me store data straight into the screen, but right now I would
rather redirect all output to a memory location, then when I want the
data on my screen, to give a command that will swap it in..
For example (Semi-Psuedo Code):
main () {
unsigned int * scrn;
scrn = MK_FP(0xb800); /* Assuming Color Monitor of course */
scrn[0] = 0x0900+'A';
printf("Hello, World\n");
}
the scrn[0] will put a white (grey?) A on the screen in the upper left corner.
But I would like to do some remapping so that printf will put
Hello, World into a variable like scrn so I can copy scrn to the actual
screen memory area at a later time. The catch is, I am trying to do this
with out changing all my printfs that I have (or any console output be it
printf, putch, putchar etc...)
Any help would be GREATLY appreciated!
-Robb Shearer
shearer@sol.cis.udel.edu
DRWilliams@cup.portal.com (Dave Richard Williams) (10/04/90)
>> rather redirect all output to a memory location
Sounds like a virtual screen handling system to me.
I don't know how you can handle it directly using printf...
but if you could somehow associate a file with a memory location
you could then reopen standard in as that memory location.. I don't
think you'll be able to handle this under ms-dos though.
WAIT A MINUET (musical interlude)
all your printf's could be #define'd to sprintf, but this
would still require modification to your printf calls (addition of
the address argument)
#define'ing printf to another routine of your choice to do the
printf to a memory location would work fine for printf, but
the rest of your I/O would be left on the screen..