I am using Borland C++ ver 3.1 in a graphic mode. I have created a 3d box on the screen (using bar3d() ) and am displaying text inside of the box. The text will change during the running of the program, so I want to just repaint the box over the text and rewrite it again. The problem I am having (besides a very inefficient function) is that when I redraw the 3d bar over the exisisting one, it makes it turn red. Here is the code:

void vertex_value()
{

setfillstyle(SOLID_FILL,BLACK);
bar3d(450,200,600,50,20,1);


setfillstyle(SOLID_FILL,BROWN);
bar3d(450,200,600,50,20,1);

char text_string[128];
int c=0;

sprintf(text_string,"Vertex[%d] =%i",c,vertex[c].excess);
outtextxy(455,55,text_string);

c++;
sprintf(text_string,"Vertex[%d] =%i",c,vertex[c].excess);
outtextxy(455,65,text_string);

c++;
sprintf(text_string,"Vertex[%d] =%i",c,vertex[c].excess);
outtextxy(455,75,text_string);

c++;
sprintf(text_string,"Vertex[%d] =%i",c,vertex[c].excess);
outtextxy(455,85,text_string);

c++;
sprintf(text_string,"Vertex[%d] =%i",c,vertex[c].excess);
outtextxy(455,95,text_string);

}

I also don't think that I am using sprintf() correctly. I have 5 vertices (or arrays) that I am displaying. The first time through, all vertices display the correct values. After the values change and the box is redrawn, some of the vertices do not display anymore. I am not sure if I am using the right letters after the "%". I came up with the ones above by trial and error.