s_johnson@csc32.enet.dec.com (Scott Johnson) (03/27/91)
Hi, I have a problem. I am in graphics mode and write a number to the display device using outtextxy(). I overwrite the number with a string of spaces to clear it. When this statement gets executed, the number is still there. After that I write a new number to the same location. The problem is that the space does not get cleared away before writing the new number. If this is done enough, then the number becomes a square and is no longer a number. The following code demonstrates the problem. A message is sent to Display to initialize and then a series of messages is sent to update the display with a new value being passed in for fish each time. I am using dos 3.3 with c++ 1.0. My monitor is vga and it uses a paradise card. Is this a bug or am I doing something wrong? Thanks for any and all help. scott --------------------------------------------- #include <iostream.h> #include <graphics.h> #include <conio.h> #include <stdlib.h> #include <string.h> #define fishx 20 int maxy; void Display::initialize(void) { int i; int delta; int gdriver=DETECT,gmode,errorcode; initgraph(&gdriver, &gmode,"\\tc\\bgi"); errorcode = graphresult(); if (errorcode != grOk){ cout<<"Graphics Error\n"; getch(); } // Get the maximum coordinates for the display in both the x and y dir. maxy = getmaxy()-20; outtextxy(fishx,maxy+10,"Fish:"); }; void Display::update(int fish) { char temp[5]; strcpy(temp," "); outtextxy(fishx+43,maxy+10,temp); getch(); itoa(fish,temp,10); outtextxy(fishx+43,maxy+10,temp); }; ------------------------------------------------------------------- Scott Johnson Digital Equipment Corporation Colorado Springs, Co