ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/frameCount/src/frameCount.c
(Generate patch)

Comparing trunk/frameCount/src/frameCount.c (file contents):
Revision 37 by mmeineke, Fri Jul 19 00:57:32 2002 UTC vs.
Revision 1086 by mmeineke, Fri Mar 5 17:21:20 2004 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines