# | Line 1 | Line 1 | |
---|---|---|
1 | #include <stdlib.h> | |
2 | #include <stdio.h> | |
3 | + | #include <string.h> |
4 | ||
5 | #include "frameCount.h" | |
6 | ||
7 | ||
8 | < | int frameCount( char* in_name ){ |
8 | > | int frameCount( char* in_name, int outTime ){ |
9 | ||
10 | FILE *in_file; | |
11 | int nFrames = 0; | |
12 | + | double time; |
13 | int i, j, k; | |
14 | int lineNum = 0; | |
15 | char readBuffer[2000]; | |
16 | + | char* foo; |
17 | ||
18 | + | |
19 | in_file = fopen( in_name, "r" ); | |
20 | if( in_file == NULL ){ | |
21 | printf( "Error opening \"%s\"\n", in_name ); | |
# | Line 25 | Line 29 | int frameCount( char* in_name ){ | |
29 | exit(8); | |
30 | } | |
31 | ||
32 | + | if(outTime) printf("# frame Num\tTime\n" ); |
33 | + | |
34 | while( !feof( in_file ) ){ | |
35 | ||
36 | i = atoi(readBuffer); | |
# | Line 37 | Line 43 | int frameCount( char* in_name ){ | |
43 | exit(8); | |
44 | } | |
45 | ||
46 | + | if(outTime){ |
47 | + | foo = strtok( readBuffer, " ,;\t" ); |
48 | + | time = atof( foo ); |
49 | + | } |
50 | ||
51 | for(j=0; j<i; j++){ | |
52 | ||
# | Line 51 | Line 61 | int frameCount( char* in_name ){ | |
61 | } | |
62 | ||
63 | nFrames++; | |
64 | + | if( outTime ){ |
65 | + | printf("%d\t%f\n", nFrames, time ); |
66 | + | } |
67 | ||
68 | fgets( readBuffer, sizeof( readBuffer ), in_file ); | |
69 | lineNum++; |
– | Removed lines |
+ | Added lines |
< | Changed lines |
> | Changed lines |