// howardconv.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include "mstring.h" // class for reading string until termination character #include #include #include #include int main(int argc, char* argv[]) { if(argc!=3) return 0; ifstream ins; char buffer[50]; mstring ms; // count number of x to see how many rows ins.open(argv[1]); int length=0; do{ ins>>buffer; if(mstring(buffer)=="x"){ length++; } }while(ins.good()); char * *x=new char *[length]; char * *y=new char *[length]; char * *z=new char *[length]; char * *ux=new char *[length]; char * *uy=new char *[length]; char * *uz=new char *[length]; char * *r=new char *[length]; // create arrays with lenght to match number of rows for(int i=0;i>buffer; if(mstring(buffer)=="x"){ xflag=1; // scans until finds the x and sets flag that has a row starting with x xsubindex=0; // initialize for count of x,y,z columns xindex++; // uping array counter according to x,y,z row number } if(mstring(buffer)=="kraft"){ uflag=1; // found a kraft row usubindex=0; uindex++; } if(mstring(buffer)=="status/taster"){ rflag=1; // same for the radius row rsubindex=0; rindex++; } // up xubindex only if just read x, otherwise get x y z from next reads after finding the x in column if(xflag==1){ if(xsubindex==1){sprintf(x[xindex],"%s",buffer);} // copy buffer only into element of the x string array if(xsubindex==2){sprintf(y[xindex],"%s",buffer);} if(xsubindex==3){sprintf(z[xindex],"%s",buffer);} xsubindex++; } if(uflag==1){ if(usubindex==1){sprintf(ux[uindex],"%s",buffer);} if(usubindex==2){sprintf(uy[uindex],"%s",buffer);} if(usubindex==3){sprintf(uz[uindex],"%s",buffer);} usubindex++; } if(rflag==1){ if(rsubindex==2){sprintf(r[rindex],"%s",buffer);} rsubindex++; } }while(ins.good()); ins.close(); FILE *p=fopen(argv[2],"w"); for( i=0;i