//Filename: textwin.cpp // TEXT WINdows DEMO, using Borland C++ ... window(), gettextinfo(), textattr() // by Wen-Nung Tsai, CSIE, NCTU #include #include #include #include #include // for strlen() //Some SYMBOLIC constants #define MINLOOP 66 // At least loop 66 times #define G_DELAY 100 // for general delay, in mili-seconds //Global int want_quit=0; struct text_info winfo[9]; // allow max 9 windows int winxy[][4]={ {22,21,55,23}, {10,6,38,18}, {45,9,76,15}}; //note this ";" is required char wintext [3] [20*40*2]; // each subwin has at most 20 rows x 40 columns char win00text[80*25*2]; // for saving the whole screen, used in gettext() void hehe(void); // a function from kbhit sample program with some modification ////////////////////main() routine /////////////////////// int main(void) { int i=0,j=0,k,m,win_n=2; long maxloop=0; static char oneline[99]; clrscr(); cprintf("How many times to Loop?"); gets(oneline); sscanf(oneline,"%ld",&maxloop); if(maxloop len) pos=1; /* Shift one char each time */ gotoxy(x,1); // gotoxy(x,wherey()); cprintf("%s",&msg[pos-1]); gotoxy(x+1+len-pos,1); // gotoxy(x+1+len-pos,wherey()); for(k=0;k