--- imach/src/imach.c 2006/01/19 13:24:36 1.106 +++ imach/src/imach.c 2006/01/25 00:51:50 1.110 @@ -1,6 +1,19 @@ -/* $Id: imach.c,v 1.106 2006/01/19 13:24:36 brouard Exp $ +/* $Id: imach.c,v 1.110 2006/01/25 00:51:50 brouard Exp $ $State: Exp $ $Log: imach.c,v $ + Revision 1.110 2006/01/25 00:51:50 brouard + (Module): Lots of cleaning and bugs added (Gompertz) + + Revision 1.109 2006/01/24 19:37:15 brouard + (Module): Comments (lines starting with a #) are allowed in data. + + Revision 1.108 2006/01/19 18:05:42 lievre + Gnuplot problem appeared... + To be fixed + + Revision 1.107 2006/01/19 16:20:37 brouard + Test existence of gnuplot in imach path + Revision 1.106 2006/01/19 13:24:36 brouard Some cleaning and links added in html output @@ -227,6 +240,12 @@ #include #include +#include +#include +#include +#include +extern int errno; + /* #include */ #include #include "timeval.h" @@ -235,11 +254,11 @@ /* #define _(String) gettext (String) */ #define MAXLINE 256 + #define GNUPLOTPROGRAM "gnuplot" /*#define GNUPLOTPROGRAM "..\\gp37mgw\\wgnuplot"*/ #define FILENAMELENGTH 132 -/*#define DEBUG*/ -/*#define windows*/ + #define GLOCK_ERROR_NOPATH -1 /* empty path */ #define GLOCK_ERROR_GETCWD -2 /* cannot get cwd */ @@ -257,17 +276,19 @@ #define AGEGOMP 10. /* Minimal age for Gompertz adjustment */ #ifdef UNIX #define DIRSEPARATOR '/' +#define CHARSEPARATOR "/" #define ODIRSEPARATOR '\\' #else #define DIRSEPARATOR '\\' +#define CHARSEPARATOR "\\" #define ODIRSEPARATOR '/' #endif -/* $Id: imach.c,v 1.106 2006/01/19 13:24:36 brouard Exp $ */ +/* $Id: imach.c,v 1.110 2006/01/25 00:51:50 brouard Exp $ */ /* $State: Exp $ */ char version[]="Imach version 0.98a, January 2006, INED-EUROREVES "; -char fullversion[]="$Revision: 1.106 $ $Date: 2006/01/19 13:24:36 $"; +char fullversion[]="$Revision: 1.110 $ $Date: 2006/01/25 00:51:50 $"; int erreur, nberr=0, nbwarn=0; /* Error number, number of errors number of warnings */ int nvar; int cptcovn=0, cptcovage=0, cptcoveff=0,cptcov; @@ -280,6 +301,7 @@ int popbased=0; int *wav; /* Number of waves for this individuual 0 is possible */ int maxwav; /* Maxim number of waves */ int jmin, jmax; /* min, max spacing between 2 waves */ +int ijmin, ijmax; /* Individuals having jmin and jmax */ int gipmx, gsw; /* Global variables on the number of contributions to the likelihood and the sum of weights (done by funcone)*/ int mle, weightopt; @@ -332,6 +354,9 @@ long time_value; extern long time(); char strcurr[80], strfor[80]; +char *endptr; +long lval; + #define NR_END 1 #define FREE_ARG char* #define FTOL 1.0e-10 @@ -388,7 +413,7 @@ double ftolhess; /* Tolerance for comput /**************** split *************************/ static int split( char *path, char *dirc, char *name, char *ext, char *finame ) { - /* From a file name with full path (either Unix or Windows) we extract the directory (dirc) + /* From a file name with (full) path (either Unix or Windows) we extract the directory (dirc) the name of the file (name), its extension only (ext) and its first part of the name (finame) */ char *ss; /* pointer */ @@ -397,7 +422,8 @@ static int split( char *path, char *dirc l1 = strlen(path ); /* length of path */ if ( l1 == 0 ) return( GLOCK_ERROR_NOPATH ); ss= strrchr( path, DIRSEPARATOR ); /* find last / */ - if ( ss == NULL ) { /* no directory, so use current */ + if ( ss == NULL ) { /* no directory, so determine current directory */ + strcpy( name, path ); /* we got the fullname name because no directory */ /*if(strrchr(path, ODIRSEPARATOR )==NULL) printf("Warning you should use %s as a separator\n",DIRSEPARATOR);*/ /* get current working directory */ @@ -405,7 +431,8 @@ static int split( char *path, char *dirc if ( getcwd( dirc, FILENAME_MAX ) == NULL ) { return( GLOCK_ERROR_GETCWD ); } - strcpy( name, path ); /* we've got it */ + /* got dirc from getcwd*/ + printf(" DIRC = %s \n",dirc); } else { /* strip direcotry from path */ ss++; /* after this, the filename */ l2 = strlen( ss ); /* length of filename */ @@ -413,14 +440,15 @@ static int split( char *path, char *dirc strcpy( name, ss ); /* save file name */ strncpy( dirc, path, l1 - l2 ); /* now the directory */ dirc[l1-l2] = 0; /* add zero */ + printf(" DIRC2 = %s \n",dirc); } + /* We add a separator at the end of dirc if not exists */ l1 = strlen( dirc ); /* length of directory */ - /*#ifdef windows - if ( dirc[l1-1] != '\\' ) { dirc[l1] = '\\'; dirc[l1+1] = 0; } -#else - if ( dirc[l1-1] != '/' ) { dirc[l1] = '/'; dirc[l1+1] = 0; } -#endif - */ + if( dirc[l1-1] != DIRSEPARATOR ){ + dirc[l1] = DIRSEPARATOR; + dirc[l1+1] = 0; + printf(" DIRC3 = %s \n",dirc); + } ss = strrchr( name, '.' ); /* find last / */ if (ss >0){ ss++; @@ -430,6 +458,7 @@ static int split( char *path, char *dirc strncpy( finame, name, l1-l2); finame[l1-l2]= 0; } + return( 0 ); /* we're done */ } @@ -2203,8 +2232,14 @@ void concatwav(int wav[], int **dh, int fprintf(ficlog," We assumed that the date of interview was correct (and not the date of death) and postponed the death %d month(s) (one stepm) after the interview. You MUST fix the contradiction between dates.\n",stepm); } k=k+1; - if (j >= jmax) jmax=j; - if (j <= jmin) jmin=j; + if (j >= jmax){ + jmax=j; + ijmax=i; + } + if (j <= jmin){ + jmin=j; + ijmin=i; + } sum=sum+j; /*if (j<0) printf("j=%d num=%d \n",j,i);*/ /* printf("%d %d %d %d\n", s[mw[mi][i]][i] ,s[mw[mi+1][i]][i],j,i);*/ @@ -2215,8 +2250,14 @@ void concatwav(int wav[], int **dh, int /* if (j<0) printf("%d %lf %lf %d %d %d\n", i,agev[mw[mi+1][i]][i], agev[mw[mi][i]][i],j,s[mw[mi][i]][i] ,s[mw[mi+1][i]][i]); */ k=k+1; - if (j >= jmax) jmax=j; - else if (j <= jmin)jmin=j; + if (j >= jmax) { + jmax=j; + ijmax=i; + } + else if (j <= jmin){ + jmin=j; + ijmin=i; + } /* if (j<10) printf("j=%d jmin=%d num=%d ",j,jmin,i); */ /*printf("%d %lf %d %d %d\n", i,agev[mw[mi][i]][i],j,s[mw[mi][i]][i] ,s[mw[mi+1][i]][i]);*/ if(j<0){ @@ -2259,8 +2300,8 @@ void concatwav(int wav[], int **dh, int } /* end wave */ } jmean=sum/k; - printf("Delay (in months) between two waves Min=%d Max=%d Mean=%f\n\n ",jmin, jmax,jmean); - fprintf(ficlog,"Delay (in months) between two waves Min=%d Max=%d Mean=%f\n\n ",jmin, jmax,jmean); + printf("Delay (in months) between two waves Min=%d (for indiviudal %ld) Max=%d (%ld) Mean=%f\n\n ",jmin, num[ijmin], jmax, num[ijmax], jmean); + fprintf(ficlog,"Delay (in months) between two waves Min=%d (for indiviudal %ld) Max=%d (%ld) Mean=%f\n\n ",jmin, ijmin, jmax, ijmax, jmean); } /*********** Tricode ****************************/ @@ -3203,10 +3244,10 @@ void printinghtml(char fileres[], char t double jprev2, double mprev2,double anprev2){ int jj1, k1, i1, cpt; - fprintf(fichtm,"
  • href="#firstorder">Result files (first order: no variance)\n \ -
  • href="#secondorder">Result files (second order (variance)\n \ + fprintf(fichtm,""); - fprintf(fichtm,"
    • Result files (first order: no variance)

      \n \ + fprintf(fichtm,"
      • Result files (first order: no variance)

        \n \ - Observed prevalence in each state (during the period defined between %.lf/%.lf/%.lf and %.lf/%.lf/%.lf): %s
        \n ", jprev1, mprev1,anprev1,jprev2, mprev2,anprev2,subdirf2(fileres,"p"),subdirf2(fileres,"p")); fprintf(fichtm,"\ @@ -3257,7 +3298,7 @@ fprintf(fichtm," \n
        • Graphs fprintf(fichtm,"\ -\n
        • Result files (second order: variances)

          \n\ +\n
        • Result files (second order: variances)

          \n\ - Parameter file with estimated parameters and covariance matrix: %s
          \n", rfileres,rfileres); fprintf(fichtm," - Variance of one-step probabilities: %s
          \n", @@ -3971,6 +4012,7 @@ double gompertz(double x[]) { double A,B,L=0.0,sump=0.,num=0.; int i,n=0; /* n is the size of the sample */ + for (i=0;i<=imx-1 ; i++) { sump=sump+weight[i]; /* sump=sump+1;*/ @@ -3983,14 +4025,15 @@ double gompertz(double x[]) for (i=1;i<=imx ; i++) { - if (cens[i]==1 & wav[i]>1) + if (cens[i] == 1 && wav[i]>1) A=-x[1]/(x[2])*(exp(x[2]*(agecens[i]-agegomp))-exp(x[2]*(ageexmed[i]-agegomp))); - if (cens[i]==0 & wav[i]>1) + if (cens[i] == 0 && wav[i]>1) A=-x[1]/(x[2])*(exp(x[2]*(agedc[i]-agegomp))-exp(x[2]*(ageexmed[i]-agegomp))) +log(x[1]/YEARM)+x[2]*(agedc[i]-agegomp)+log(YEARM); - if (wav[i]>1 & agecens[i]>15) { + /*if (wav[i] > 1 && agecens[i] > 15) {*/ /* ??? */ + if (wav[i] > 1 ) { /* ??? */ L=L+A*weight[i]; /* printf("\ni=%d A=%f L=%lf x[1]=%lf x[2]=%lf ageex=%lf agecens=%lf cens=%d agedc=%lf weight=%lf\n",i,A,L,x[1],x[2],ageexmed[i]*12,agecens[i]*12,cens[i],agedc[i]*12,weight[i]);*/ } @@ -4059,6 +4102,7 @@ int main(int argc, char *argv[]) { int movingaverage(double ***probs, double bage,double fage, double ***mobaverage, int mobilav); int i,j, k, n=MAXN,iter,m,size=100,cptcode, cptcod; + int linei, month, year,iout; int jj, ll, li, lj, lk, imk; int numlinepar=0; /* Current linenumber of parameter file */ int itimes; @@ -4067,6 +4111,7 @@ int main(int argc, char *argv[]) char ca[32], cb[32], cc[32]; /* FILE *fichtm; *//* Html File */ /* FILE *ficgp;*/ /*Gnuplot File */ + struct stat info; double agedeb, agefin,hf; double ageminpar=1.e20,agemin=1.e20, agemaxpar=-1.e20, agemax=-1.e20; @@ -4167,10 +4212,14 @@ int main(int argc, char *argv[]) printf("pathtot=%s, path=%s, optionfile=%s\n",pathtot,path,optionfile);*/ /* cutv(path,optionfile,pathtot,'\\');*/ + /* Split argv[0], imach program to get pathimach */ + printf("\nargv[0]=%s argv[1]=%s, \n",argv[0],argv[1]); split(argv[0],pathimach,optionfile,optionfilext,optionfilefiname); + printf("\nargv[0]=%s pathimach=%s, \noptionfile=%s \noptionfilext=%s \noptionfilefiname=%s\n",argv[0],pathimach,optionfile,optionfilext,optionfilefiname); /* strcpy(pathimach,argv[0]); */ + /* Split argv[1]=pathtot, parameter file name to get path, optionfile, extension and name */ split(pathtot,path,optionfile,optionfilext,optionfilefiname); - printf("pathimach=%s, pathtot=%s,\npath=%s,\noptionfile=%s \noptionfilext=%s \noptionfilefiname=%s\n",pathimach,pathtot,path,optionfile,optionfilext,optionfilefiname); + printf("\npathtot=%s,\npath=%s,\noptionfile=%s \noptionfilext=%s \noptionfilefiname=%s\n",pathtot,path,optionfile,optionfilext,optionfilefiname); chdir(path); strcpy(command,"mkdir "); strcat(command,optionfilefiname); @@ -4337,7 +4386,6 @@ int main(int argc, char *argv[]) } fflush(ficlog); - p=param[1][1]; /* Reads comments: lines beginning with '#' */ @@ -4461,43 +4509,115 @@ int main(int argc, char *argv[]) ncodemax=ivector(1,8); i=1; - while (fgets(line, MAXLINE, fic) != NULL) { - if ((i >= firstobs) && (i <=lastobs)) { - for(j=0; line[j] != '\n';j++){ /* Untabifies line */ + linei=0; + while ((fgets(line, MAXLINE, fic) != NULL) &&((i >= firstobs) && (i <=lastobs))) { + linei=linei+1; + for(j=strlen(line); j>=0;j--){ /* Untabifies line */ if(line[j] == '\t') line[j] = ' '; } + for(j=strlen(line)-1; (line[j]==' ')||(line[j]==10)||(line[j]==13);j--){ + ; + }; + line[j+1]=0; /* Trims blanks at end of line */ + if(line[0]=='#'){ + fprintf(ficlog,"Comment line\n%s\n",line); + printf("Comment line\n%s\n",line); + continue; + } for (j=maxwav;j>=1;j--){ - cutv(stra, strb,line,' '); s[j][i]=atoi(strb); + cutv(stra, strb,line,' '); + errno=0; + lval=strtol(strb,&endptr,10); + /* if (errno == ERANGE && (lval == LONG_MAX || lval == LONG_MIN))*/ + if( strb[0]=='\0' || (*endptr != '\0')){ + printf("Error reading data around '%d' at line number %d %s for individual %d\nShould be a status of wave %d. Setting maxwav=%d might be wrong. Exiting.\n",lval, i,line,linei,j,maxwav); + exit(1); + } + s[j][i]=lval; + strcpy(line,stra); - cutv(stra, strb,line,'/'); anint[j][i]=(double)(atoi(strb)); strcpy(line,stra); - cutv(stra, strb,line,' '); mint[j][i]=(double)(atoi(strb)); strcpy(line,stra); - } + cutv(stra, strb,line,' '); + if(iout=sscanf(strb,"%d/%d",&month, &year) != 0){ + } + else if(iout=sscanf(strb,".") != 0){ + month=99; + year=9999; + }else{ + printf("Error reading data around '%s'.at line number %ld %s for individual %d\nShould be a year of exam at wave %d. Exiting.\n",strb, i,line,linei,j); + exit(1); + } + anint[j][i]= (double) year; + mint[j][i]= (double)month; + strcpy(line,stra); + } /* ENd Waves */ - cutv(stra, strb,line,'/'); andc[i]=(double)(atoi(strb)); strcpy(line,stra); - cutv(stra, strb,line,' '); moisdc[i]=(double)(atoi(strb)); strcpy(line,stra); - - cutv(stra, strb,line,'/'); annais[i]=(double)(atoi(strb)); strcpy(line,stra); - cutv(stra, strb,line,' '); moisnais[i]=(double)(atoi(strb)); strcpy(line,stra); + cutv(stra, strb,line,' '); + if(iout=sscanf(strb,"%d/%d",&month, &year) != 0){ + } + else if(iout=sscanf(strb,".") != 0){ + month=99; + year=9999; + }else{ + printf("Error reading data around '%s'.at line number %ld %s for individual %d\nShould be a year of exam at wave %d. Exiting.\n",strb, i,line,linei,j); + exit(1); + } + andc[i]=(double) year; + moisdc[i]=(double) month; + strcpy(line,stra); + + cutv(stra, strb,line,' '); + if(iout=sscanf(strb,"%d/%d",&month, &year) != 0){ + } + else if(iout=sscanf(strb,".") != 0){ + month=99; + year=9999; + }else{ + printf("Error reading data around '%s'.at line number %ld %s for individual %d\nShould be a year of exam at wave %d. Exiting.\n",strb, i,line,linei,j); + exit(1); + } + annais[i]=(double)(year); + moisnais[i]=(double)(month); + strcpy(line,stra); + + cutv(stra, strb,line,' '); + errno=0; + lval=strtol(strb,&endptr,10); + if( strb[0]=='\0' || (*endptr != '\0')){ + printf("Error reading data around '%d' at line number %ld %s for individual %d\nShould be a weight. Exiting.\n",lval, i,line,linei); + exit(1); + } + weight[i]=(double)(lval); + strcpy(line,stra); - cutv(stra, strb,line,' '); weight[i]=(double)(atoi(strb)); strcpy(line,stra); for (j=ncovcol;j>=1;j--){ - cutv(stra, strb,line,' '); covar[j][i]=(double)(atoi(strb)); strcpy(line,stra); + cutv(stra, strb,line,' '); + errno=0; + lval=strtol(strb,&endptr,10); + if( strb[0]=='\0' || (*endptr != '\0')){ + printf("Error reading data around '%d' at line number %ld %s for individual %d\nShould be a covar (meaning 0 for the reference or 1). Exiting.\n",lval, i,line,linei); + exit(1); + } + if(lval <-1 || lval >1){ + printf("Error reading data around '%d' at line number %ld %s for individual %d\nShould be a value of the %d covar (meaning 0 for the reference or 1. IMaCh does not build design variables, do it your self). Exiting.\n",lval,i,line,linei,j); + exit(1); + } + covar[j][i]=(double)(lval); + strcpy(line,stra); } lstra=strlen(stra); + if(lstra > 9){ /* More than 2**32 or max of what printf can write with %ld */ stratrunc = &(stra[lstra-9]); num[i]=atol(stratrunc); } else num[i]=atol(stra); - /*if((s[2][i]==2) && (s[3][i]==-1)&&(s[4][i]==9)){ printf("%ld %.lf %.lf %.lf %.lf/%.lf %.lf/%.lf %.lf/%.lf %d %.lf/%.lf %d %.lf/%.lf %d %.lf/%.lf %d\n",num[i],(covar[1][i]), (covar[2][i]),weight[i], (moisnais[i]), (annais[i]), (moisdc[i]), (andc[i]), (mint[1][i]), (anint[1][i]), (s[1][i]), (mint[2][i]), (anint[2][i]), (s[2][i]), (mint[3][i]), (anint[3][i]), (s[3][i]), (mint[4][i]), (anint[4][i]), (s[4][i])); ij=ij+1;}*/ i=i+1; - } - } + } /* End loop reading data */ /* printf("ii=%d", ij); scanf("%d",i);*/ imx=i-1; /* Number of individuals */ @@ -4645,8 +4765,7 @@ int main(int argc, char *argv[]) } } else if(s[m][i] !=9){ /* Standard case, age in fractional - years but with the precision of a - month */ + years but with the precision of a month */ agev[m][i]=(mint[m][i]/12.+1./24.+anint[m][i])-(moisnais[i]/12.+1./24.+annais[i]); if((int)mint[m][i]==99 || (int)anint[m][i]==9999) agev[m][i]=1; @@ -4822,6 +4941,7 @@ Interval (in months) between two waves: p=param[1][1]; /* *(*(*(param +1)+1)+0) */ globpr=0; /* To get the number ipmx of contributions and the sum of weights*/ + if (mle==-3){ ximort=matrix(1,NDIM,1,NDIM); cens=ivector(1,n); @@ -4831,9 +4951,9 @@ Interval (in months) between two waves: for (i=1; i<=imx; i++){ dcwave[i]=-1; - for (j=1; j<=lastpass; j++) - if (s[j][i]>nlstate) { - dcwave[i]=j; + for (m=firstpass; m<=lastpass; m++) + if (s[m][i]>nlstate) { + dcwave[i]=m; /* printf("i=%d j=%d s=%d dcwave=%d\n",i,j, s[j][i],dcwave[i]);*/ break; } @@ -4842,12 +4962,16 @@ Interval (in months) between two waves: for (i=1; i<=imx; i++) { if (wav[i]>0){ ageexmed[i]=agev[mw[1][i]][i]; - j=wav[i];agecens[i]=1.; - if (ageexmed[i]>1 & wav[i]>0) agecens[i]=agev[mw[j][i]][i]; - cens[i]=1; - - if (ageexmed[i]<1) cens[i]=-1; - if (agedc[i]< AGESUP & agedc[i]>1 & dcwave[i]>firstpass & dcwave[i]<=lastpass) cens[i]=0 ; + j=wav[i]; + agecens[i]=1.; + + if (ageexmed[i]> 1 && wav[i] > 0){ + agecens[i]=agev[mw[j][i]][i]; + cens[i]= 1; + }else if (ageexmed[i]< 1) + cens[i]= -1; + if (agedc[i]< AGESUP && agedc[i]>1 && dcwave[i]>firstpass && dcwave[i]<=lastpass) + cens[i]=0 ; } else cens[i]=-1; } @@ -4856,29 +4980,29 @@ Interval (in months) between two waves: for (j=1;j<=NDIM;j++) ximort[i][j]=(i == j ? 1.0 : 0.0); } - - p[1]=0.1; p[2]=0.1; + + p[1]=0.1; p[NDIM]=0.1; /*printf("%lf %lf", p[1], p[2]);*/ - printf("Powell\n"); fprintf(ficlog,"Powell\n"); - strcpy(filerespow,"pow-mort"); - strcat(filerespow,fileres); - if((ficrespow=fopen(filerespow,"w"))==NULL) { - printf("Problem with resultfile: %s\n", filerespow); - fprintf(ficlog,"Problem with resultfile: %s\n", filerespow); - } - fprintf(ficrespow,"# Powell\n# iter -2*LL"); - /* for (i=1;i<=nlstate;i++) - for(j=1;j<=nlstate+ndeath;j++) - if(j!=i)fprintf(ficrespow," p%1d%1d",i,j); - */ - fprintf(ficrespow,"\n"); - + printf("Powell\n"); fprintf(ficlog,"Powell\n"); + strcpy(filerespow,"pow-mort"); + strcat(filerespow,fileres); + if((ficrespow=fopen(filerespow,"w"))==NULL) { + printf("Problem with resultfile: %s\n", filerespow); + fprintf(ficlog,"Problem with resultfile: %s\n", filerespow); + } + fprintf(ficrespow,"# Powell\n# iter -2*LL"); + /* for (i=1;i<=nlstate;i++) + for(j=1;j<=nlstate+ndeath;j++) + if(j!=i)fprintf(ficrespow," p%1d%1d",i,j); + */ + fprintf(ficrespow,"\n"); + powell(p,ximort,NDIM,ftol,&iter,&fret,gompertz); fclose(ficrespow); - hesscov(matcov, p, NDIM,delti, 1e-4, gompertz); + hesscov(matcov, p, NDIM, delti, 1e-4, gompertz); for(i=1; i <=NDIM; i++) for(j=i+1;j<=NDIM;j++) @@ -4896,48 +5020,48 @@ Interval (in months) between two waves: for (i=1;i<=NDIM;i++) printf("%f [%f ; %f]\n",p[i],p[i]-2*sqrt(matcov[i][i]),p[i]+2*sqrt(matcov[i][i])); -lsurv=vector(1,AGESUP); + lsurv=vector(1,AGESUP); lpop=vector(1,AGESUP); tpop=vector(1,AGESUP); lsurv[agegomp]=100000; - - for (k=agegomp;k<=AGESUP;k++) { + + for (k=agegomp;k<=AGESUP;k++) { agemortsup=k; if (p[1]*exp(p[2]*(k-agegomp))>1) break; } - - for (k=agegomp;k=1 */ likelione(ficres, p, npar, nlstate, &globpr, &ipmx, &sw, &fretone, funcone); /* Prints the contributions to the likelihood */ @@ -5530,15 +5654,35 @@ lsurv=vector(1,AGESUP); /*------ End -----------*/ chdir(path); +#ifndef UNIX + /* strcpy(plotcmd,"\""); */ +#endif + strcpy(plotcmd,pathimach); + /*strcat(plotcmd,CHARSEPARATOR);*/ + strcat(plotcmd,GNUPLOTPROGRAM); +#ifndef UNIX + strcat(plotcmd,".exe"); + /* strcat(plotcmd,"\"");*/ +#endif + if(stat(plotcmd,&info)){ + printf("Error gnuplot program not found: %s\n",plotcmd);fflush(stdout); + } + +#ifndef UNIX strcpy(plotcmd,"\""); +#endif strcat(plotcmd,pathimach); strcat(plotcmd,GNUPLOTPROGRAM); +#ifndef UNIX + strcat(plotcmd,".exe"); strcat(plotcmd,"\""); +#endif strcat(plotcmd," "); strcat(plotcmd,optionfilegnuplot); printf("Starting graphs with: %s",plotcmd);fflush(stdout); + if((outcmd=system(plotcmd)) != 0){ - printf(" Problem with gnuplot\n"); + printf("\n Problem with gnuplot\n"); } printf(" Wait..."); while (z[0] != 'q') {