Changeset 32 in TRACY3 for trunk/tracy/tracy/src/read_script.cc
- Timestamp:
- Apr 9, 2014, 3:50:11 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tracy/tracy/src/read_script.cc
r11 r32 78 78 79 79 80 char str[max_str]=" voidstring", dummy[max_str]="voidstring",dummy2[max_str]="voidstring", nextpara[max_str]="voidpara";81 char in[max_str] ; //temporary line with preceding white space80 char str[max_str]="", dummy[max_str]="",dummy2[max_str]="", nextpara[max_str]=""; 81 char in[max_str]=""; //temporary line with preceding white space 82 82 char *line = NULL; //line to store the command without preceding white space 83 83 size_t len = 0; 84 84 ssize_t read; 85 char name[max_str]=" voidname";85 char name[max_str]=""; //initialize with empty character array. 86 86 // char lat_file[max_str]="voidlattice"; 87 char EndName[ ]="void";87 char EndName[5]=""; 88 88 89 89 FILE *inf; … … 92 92 long int NameLen=0L; 93 93 int idummy=0; 94 char full_param_file_name[max_str] ;95 char lat_FileName[max_str] ;94 char full_param_file_name[max_str]=""; 95 char lat_FileName[max_str]=""; 96 96 //bool TuneTracFlag; 97 97 char *pch; … … 115 115 116 116 LineNum++; 117 if( prt){117 if(!prt){ 118 118 printf("Line # %ld \n",LineNum); 119 119 printf("Retrieved line of length %zu : \n",read); … … 126 126 if (strstr(line, "#") == NULL && line[0] != '\n' && 127 127 line[0] != '\r' && strcmp(line, "\r\n") != 0 ){ 128 129 128 130 // get initial command token 129 131 sscanf(line, "%s", name); … … 134 136 //find the sequence of the bool flag in user input script 135 137 NameLen = strlen(name); 136 EndName[0] = name[NameLen-4]; 137 EndName[1] = name[NameLen-3]; 138 EndName[2] = name[NameLen-2]; 139 EndName[3] = name[NameLen-1]; 140 138 if(NameLen >= 4 ){ 139 EndName[0] = name[NameLen-4]; 140 EndName[1] = name[NameLen-3]; 141 EndName[2] = name[NameLen-2]; 142 EndName[3] = name[NameLen-1]; 143 } 141 144 //find the bool flag whose last 4 character are 'Flag' 142 145 if(strcmp(EndName,"Flag")==0)
Note: See TracChangeset
for help on using the changeset viewer.