4. Draw plot file
You have to know about the structur of a plot file to program the drawing
(
//Set the pointers
ptr1 = &cBuffer[0];
ptr1end = ptr1 + nFileSize; //Pointers are set
while(ptr1 < ptr1end)
{
ptr2 = &cLine[0]; // ptr2 on top of the small memory
while(*ptr1 != ';') *ptr2++ = *ptr1++; // while ptr1 unequal ';'
ptr1++; // jump over the semicolon
*ptr2 = NULL; //end of string
// ====data are in the small memory====
if(cLine[0]=='P') // evaluation only when the first letter is a 'P'
{
if(cLine[1]== 'U') penx = 0; //if the first letter is an 'U' pen x = 0 (move to)
if(cLine[1]== 'D') penx = 1; //if the first letter is an 'D' pen x = 1 (line to)
if(cLine[1]== 'A') //if the first letter is an 'A' the linescan can begin
{
sscanf(cLine,"PA%d,%d", &aa, &bb); aa/=40; bb/=40;//scan the line(line,"how exactly looks the line",make aa & bb looks like the coordinats)
xx=350-aa; //move the picture in x-direction
yy=240-bb; //move the picture in y-direction
if(penx == 0) pDC->MoveTo(xx,yy); //move to the coordinats xx,yy only when penx=0
else pDC->LineTo(xx,yy); //line to the coordinats xx,yy only when penx=1
}//end when 'A'
}//end when first letter = 'P'
}// End of ptr1
)