| 4 |
|
#include <unistd.h> |
| 5 |
|
|
| 6 |
|
#define MAX_FILES 1000 |
| 7 |
+ |
#define STR_BUFFER 2000 |
| 8 |
|
|
| 9 |
|
void usage( void ); |
| 10 |
|
|
| 17 |
|
double boxX, boxY, boxZ; |
| 18 |
|
char* foo; |
| 19 |
|
char* in_name[MAX_FILES]; |
| 20 |
< |
char readBuffer[2000]; |
| 20 |
> |
char readBuffer[STR_BUFFER]; |
| 21 |
> |
char writeBuffer[STR_BUFFER]; |
| 22 |
|
int i,j,k; |
| 23 |
|
int lineNum; |
| 24 |
|
|
| 205 |
|
exit(8); |
| 206 |
|
} |
| 207 |
|
|
| 208 |
+ |
for(j=0; j<STR_BUFFER; j++) writeBuffer[j] = readBuffer[j]; |
| 209 |
+ |
|
| 210 |
|
|
| 211 |
|
foo = strtok(readBuffer, " ,;\t"); |
| 212 |
|
if(foo == NULL){ |
| 215 |
|
exit(8); |
| 216 |
|
} |
| 217 |
|
|
| 218 |
+ |
j = strlen( foo ); |
| 219 |
|
currentTime = atof( foo ); |
| 220 |
|
realTime = currentTime + lastTime; |
| 221 |
|
|
| 217 |
– |
|
| 218 |
– |
foo = strtok(NULL, " ,;\t"); |
| 219 |
– |
if(foo == NULL){ |
| 220 |
– |
printf("error in reading boxX at line %d in %s\n", lineNum, |
| 221 |
– |
in_name[0]); |
| 222 |
– |
exit(8); |
| 223 |
– |
} |
| 224 |
– |
|
| 225 |
– |
boxX = atof( foo ); |
| 226 |
– |
|
| 227 |
– |
foo = strtok(NULL, " ,;\t"); |
| 228 |
– |
if(foo == NULL){ |
| 229 |
– |
printf("error in reading boxY at line %d in %s\n", lineNum, |
| 230 |
– |
in_name[0]); |
| 231 |
– |
exit(8); |
| 232 |
– |
} |
| 233 |
– |
|
| 234 |
– |
boxY = atof( foo ); |
| 235 |
– |
|
| 236 |
– |
foo = strtok(NULL, " ,;\t"); |
| 237 |
– |
if(foo == NULL){ |
| 238 |
– |
printf("error in reading boxZ at line %d in %s\n", lineNum, |
| 239 |
– |
in_name[0]); |
| 240 |
– |
exit(8); |
| 241 |
– |
} |
| 242 |
– |
|
| 243 |
– |
boxZ = atof( foo ); |
| 244 |
– |
|
| 222 |
|
printMe = !( ((int)realTime) % timeMod ); |
| 223 |
|
|
| 224 |
|
if( printMe ){ |
| 225 |
< |
fprintf( out_file, "%d\n", i ); |
| 226 |
< |
fprintf( out_file, "%lf\t%lf\t%lf\t%lf\n", |
| 227 |
< |
realTime, boxX, boxY, boxZ ); |
| 225 |
> |
fprintf( out_file, |
| 226 |
> |
"%d\n" |
| 227 |
> |
"%d%s\n", |
| 228 |
> |
i, realTime, &(writeBuffer[j]) ); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
for(j=0; j<i; j++){ |
| 314 |
|
exit(8); |
| 315 |
|
} |
| 316 |
|
|
| 317 |
+ |
for(j=0; j<STR_BUFFER; j++) writeBuffer[j] = readBuffer[j]; |
| 318 |
|
|
| 319 |
|
foo = strtok(readBuffer, " ,;\t"); |
| 320 |
|
if(foo == NULL){ |
| 322 |
|
in_name[k]); |
| 323 |
|
exit(8); |
| 324 |
|
} |
| 325 |
< |
|
| 325 |
> |
|
| 326 |
> |
j = strlen( foo ); |
| 327 |
|
currentTime = atof( foo ); |
| 328 |
|
realTime = currentTime + lastTime; |
| 329 |
|
|
| 350 |
– |
|
| 351 |
– |
foo = strtok(NULL, " ,;\t"); |
| 352 |
– |
if(foo == NULL){ |
| 353 |
– |
printf("error in reading boxX at line %d in %s\n", lineNum, |
| 354 |
– |
in_name[k]); |
| 355 |
– |
exit(8); |
| 356 |
– |
} |
| 357 |
– |
|
| 358 |
– |
boxX = atof( foo ); |
| 359 |
– |
|
| 360 |
– |
foo = strtok(NULL, " ,;\t"); |
| 361 |
– |
if(foo == NULL){ |
| 362 |
– |
printf("error in reading boxY at line %d in %s\n", lineNum, |
| 363 |
– |
in_name[k]); |
| 364 |
– |
exit(8); |
| 365 |
– |
} |
| 366 |
– |
|
| 367 |
– |
boxY = atof( foo ); |
| 368 |
– |
|
| 369 |
– |
foo = strtok(NULL, " ,;\t"); |
| 370 |
– |
if(foo == NULL){ |
| 371 |
– |
printf("error in reading boxZ at line %d in %s\n", lineNum, |
| 372 |
– |
in_name[k]); |
| 373 |
– |
exit(8); |
| 374 |
– |
} |
| 375 |
– |
|
| 376 |
– |
boxZ = atof( foo ); |
| 377 |
– |
|
| 330 |
|
printMe = !( ((int)realTime) % timeMod ); |
| 331 |
|
|
| 332 |
|
if( printMe ){ |
| 333 |
< |
fprintf( out_file, "%d\n", i ); |
| 334 |
< |
fprintf( out_file, "%lf\t%lf\t%lf\t%lf\n", |
| 335 |
< |
realTime, boxX, boxY, boxZ ); |
| 333 |
> |
fprintf( out_file, |
| 334 |
> |
"%d\n" |
| 335 |
> |
"%d%s\n", |
| 336 |
> |
i, realTime, &(writeBuffer[j]) ); |
| 337 |
|
} |
| 338 |
|
|
| 339 |
|
for(j=0; j<i; j++){ |