Category : C Source Code
Archive   : BCPPTECH.ZIP
Filename : TI452.ASC

 
Output of file : TI452.ASC contained in archive : BCPPTECH.ZIP






PRODUCT : TURBO C NUMBER : 452
VERSION : 2.O
OS : PC-DOS
DATE : FEBRUARY 2, 1989 PAGE : 1/1

TITLE : ERASING CHARACTERS (OR "TEXT")




The following program demonstrates two methods of removing
previously displayed characters. The first method uses the bar
function to erase the desired area of the screen. The second
method involves overwriting the font in the current background
color. Both methods are effective, and the choice of methods
would be based on the needs of the particular application.


#include
#include

main()
{
int driver = DETECT; /* autodetect driver */
int mode;
int oldcolor;
int x=10;
int y=10;
char string1[] = "Hello";
char string2[] = "world";
char string3[] = "Goodbye";

initgraph(&driver, &mode, "");

outtextxy(x, y, string1); /* print a string */
sleep(1); /* wait a second */

/*** erase text by drawing a bar ***/
setfillstyle(SOLID_FILL, getbkcolor());
bar(x, y, x+textwidth(string1), y+textheight(string1));

outtextxy(x, y, string2); /* print another string */
sleep(1); /* wait another second */

/*** erase the string by overwriting ***/
oldcolor = getcolor(); /* save current color */
setcolor( getbkcolor() ); /* set to background color */
outtextxy(x, y, string2); /* erase string */
setcolor(oldcolor); /* restore color */

outtextxy(x, y, string3); /* print one more string */
sleep(1); /* wait one more second */

closegraph();
return 0;
}






  3 Responses to “Category : C Source Code
Archive   : BCPPTECH.ZIP
Filename : TI452.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/