--- trunk/frameCount/src/frameCount.c 2002/07/19 00:48:45 36 +++ trunk/frameCount/src/frameCount.c 2002/07/19 00:57:32 37 @@ -5,56 +5,58 @@ int frameCount( char* in_name ){ int frameCount( char* in_name ){ + + FILE *in_file; + int nFrames = 0; + int i, j, k; + int lineNum = 0; + char readBuffer[2000]; + + in_file = fopen( in_name, "r" ); + if( in_file == NULL ){ + printf( "Error opening \"%s\"\n", in_name ); + exit(8); + } + + fgets( readBuffer, sizeof( readBuffer ), in_file ); + lineNum++; + if( feof( in_file ) ){ + printf( "File ended unexpectedly at line %d\n", lineNum ); + exit(8); + } + + while( !feof( in_file ) ){ + + i = atoi(readBuffer); - FILE *in_file; - int nFrames = 0; - int i, j, k; - int lineNum = 0; - char readBuffer[2000]; - - in_file = fopen( in_name, "r" ); - if( in_file == NULL ){ - printf( "Error opening \"%s\"\n", in_name ); - exit(8); - } - - if( feof( in_file ) ){ - printf( "File ended unexpectedly at line %d\n", lineNum ); - exit(8); - } + fgets( readBuffer, sizeof( readBuffer ), in_file ); + lineNum++; + if( feof( in_file ) ){ + printf( "File ended unexpectedly at line %d, in frame%d\n", + lineNum, nFrames+1 ); + exit(8); + } - fgets( readBuffer, sizeof( readBuffer ), in_file ); - lineNum++; - - while( !feof( in_file ) ){ - - i = atoi(readBuffer); - - if( feof( in_file ) ){ - printf( "File ended unexpectedly at line %d, in frame%d\n", lineNum, nFrames+1 ); - exit(8); - } - fgets( readBuffer, sizeof( readBuffer ), in_file ); - lineNum++; - - for(j=0; j