| 1 |
|
#include <stdlib.h> |
| 2 |
|
#include <stdio.h> |
| 3 |
|
|
| 4 |
< |
int main(int argc, char *argv[] ){ |
| 4 |
> |
#include "frameCount.h" |
| 5 |
|
|
| 6 |
+ |
|
| 7 |
+ |
int frameCount( char* in_name ){ |
| 8 |
+ |
|
| 9 |
|
FILE *in_file; |
| 10 |
|
int nFrames = 0; |
| 11 |
|
int i, j, k; |
| 12 |
|
int lineNum = 0; |
| 13 |
< |
char readBuffer[1000]; |
| 13 |
> |
char readBuffer[2000]; |
| 14 |
|
|
| 15 |
< |
|
| 13 |
< |
if( argc != 2 ){ |
| 14 |
< |
printf( "I need a dump file to read.\n" ); |
| 15 |
< |
exit(8); |
| 16 |
< |
} |
| 17 |
< |
|
| 18 |
< |
in_file = fopen( argv[1], "r" ); |
| 15 |
> |
in_file = fopen( in_name, "r" ); |
| 16 |
|
if( in_file == NULL ){ |
| 17 |
< |
printf( "Error opening \"%s\"\n", argv[1] ); |
| 17 |
> |
printf( "Error opening \"%s\"\n", in_name ); |
| 18 |
|
exit(8); |
| 19 |
|
} |
| 20 |
|
|
| 54 |
|
lineNum++; |
| 55 |
|
} |
| 56 |
|
|
| 60 |
– |
printf( "file \"%s\" has %d frames.\n", argv[1], nFrames ); |
| 61 |
– |
|
| 57 |
|
fclose( in_file ); |
| 58 |
|
|
| 59 |
< |
return 0; |
| 59 |
> |
return nFrames; |
| 60 |
|
} |