Subj : platforms To : borland.public.cpp.borlandcpp From : "Rob C. " Date : Sat Dec 06 2003 01:57 pm This is a problem that’s little hard to explain. I don’t know if you remember my situation, but some months back I had a need to save to a file the text and colors of a particular x/y position that where currently on the screen. The savetextattriubute function wouldn’t serve my purposes. So you or someone there custom-wrote me a function that would do it. The function is listed below. And this function works great! I use it all the time. It works great, that is, in BC++ DOS platform. (but DOS is obsolete) When I compile it in Win32, console mode, (which as I understand it is similar to the DOS platform) it gives me a whole host of errors (listed below). And it’s just the savescreen(); function. If I remove it, all my other functions work fine. //------------------------------------------- in DOS platform. . . . Info :Making... Info :Building... Info :Compiling C:\BC5\Robcpp\goexe.cpp Warn : MYFUNCS.H(33,2):Cannot create pre-compiled header: initialized data in header Info :Transferring to C:\BC5\BIN\tlink.exe @C:\BC5\ROBCPP\GOEXE.R$P //------------------------------------------- In Win32, console mode . . . Info :Making... Info :Making... Info :Compiling C:\BC5\Robcpp\goexe.cpp Error: MYFUNCS.H(38,26):Undefined structure 'REGPACK' Error: MYFUNCS.H(38,29):Too many initializers Error: MYFUNCS.H(63,8):'r_ax' is not a member of 'REGPACK' Error: MYFUNCS.H(64,6):Call to undefined function 'intr' Error: MYFUNCS.H(66,34):'r_ax' is not a member of 'REGPACK' Error: MYFUNCS.H(66,42):'r_ax' is not a member of 'REGPACK' Warn : MYFUNCS.H(495,34):Comparing signed and unsigned values Warn : MYFUNCS.H(499,33):Comparing signed and unsigned values Warn : MYFUNCS.H(528,18):Comparing signed and unsigned values Warn : MYFUNCS.H(33,2):Cannot create pre-compiled header: initialized data in header //------------------------------------------- CODE . . . int MYFUNCS::savescreen( int col, int row, int endcol, int endrow, char filename[] ) { //1299 FILE *fp; struct REGPACK rp = {0}; char attr[10]; int SAVECOL, recnum; fp = fopen( filename, "wb" ); if (fp == NULL) { printf("saveattr 42 error opening %s for write.\n" , filename ); fclose(fp); getch(); return 1; } SAVECOL=col; recnum= 0; while(1) { //55 if( row > endrow ) break; while(1) { //94 gotoxy( col, row ); rp.r_ax = 0x0800; intr(0x10, &rp); sprintf( attr, "%x %c ", rp.r_ax, rp.r_ax & 0x00ff ); if( attr[2] == ' ' ) { attr[5] = attr[3]; attr[3] = attr[1]; attr[2] = attr[0]; attr[0] = '0'; attr[1] = '0'; } else if( attr[3] == ' ' ) { attr[5] = attr[4]; //attr[4] = '\0'; attr[3] = attr[2]; attr[2] = attr[1]; attr[1] = '0'; } //write to binary file data.recnum = recnum; data.Sletter[0] = attr[5]; data.Sletter[1] = '\0'; data.Srow = row; data.Scol = col; data.Sforegrnd = attr[1]; data.Sbackgrnd = attr[0]; data.nextrec = recnum + 1; if( fwrite( &data, sizeof( struct SAVESCREEN ), 1, fp ) != 1 ) { clrscr(); // rn2( 0x17 ); cprintf( "myfuncs 1562 Error reading record: %d", recnum ); break; //getch(); } col++; if( col > endcol ) { //72 col = SAVECOL; row++; break; } //72 recnum++; attr[0] = '\0'; } //94 } //55 fclose(fp); return 0; } //1299 .