I'm something of a C++ novice and I have this legacy code C++ program I am attampting to update. Basically, this program scrapes the contents of an emulator, formats, and then sends the data to a specialized printer. This code compiled in VS 6.0 without any problems but now when I compile it in VS .NET it throws a stack error message for variable psL when it is executed.
Obviously, this is happening in the FOR loop yet my printer prints fine and it never complained about it in VS 6.0. I reduced the value of MAXLINES but that didn't fix anything and it didn't print the last line, so 1) why does .NET think it's wrong and 2) how do I fix it?
Thanks!
Code:
// -------------------------------
// Print Bundle Summary
// -------------------------------
void PrintBundleSummary()
{
int i;
const int MAXLINES = 18;
const int MAXLENGTH = 67;
union psLineU {
char psLine[MAXLINES][80];
char psLinew[1440];
} psL;
char sWork[128];
PrinterStart();
RCPprinterControl(RCPCLOSEJAW);
wFldLen = sizeof psL.psLinew;
wFldLoc = 91;
RCPCopyPSstr(psL.psLinew, wFldLen, wFldLoc); //Scrape contents of emulator screen
for (i=0; i<MAXLINES; i++) {
psL.psLine[i][MAXLENGTH] = '\0';
sprintf (sWork, "%s\r\n", psL.psLine[i]); //Build sWork
PrinterSendDataString (sWork); //Print contents of sWork
}
RCPprinterControl(RCPSTARLINE);
RCPprinterControl(RCPPAPEREJECT);
RCPprinterControl(RCPPAPEREJECT);
PrinterStop ();
return;
}
Thanks!