11 |
|
#include "readWrite.h" |
12 |
|
|
13 |
|
|
14 |
+ |
#define BUFFER_SIZE 2000 |
15 |
|
int isScanned; |
16 |
|
FILE* inFile; |
17 |
|
|
45 |
|
struct linkedPos* headPos; |
46 |
|
struct linkedPos* currPos; |
47 |
|
fpos_t *currPT; |
48 |
+ |
char readBuffer[BUFFER_SIZE]; |
49 |
+ |
char* foo; |
50 |
+ |
int lineNum = 0; |
51 |
+ |
|
52 |
+ |
|
53 |
|
|
48 |
– |
|
54 |
|
inFile = fopen(inName); |
55 |
|
if(inFile ==NULL){ |
56 |
|
fprintf(stderr, |
60 |
|
} |
61 |
|
|
62 |
|
|
63 |
< |
headPos = (struct linkedPos*)malloc( |
63 |
> |
headPos = (struct linkedPos*)malloc(sizeof(struct linkedPos)); |
64 |
|
while( !feof( inFile ) ){ |
65 |
|
|
66 |
< |
currPT |
67 |
< |
|
66 |
> |
currPT = (fpos_t *)malloc(sizeof(fpos_t)); |
67 |
> |
fgetpos(inFile, currPT); |
68 |
> |
|
69 |
> |
fgets( readBuffer, sizeof( readBuffer ), inFile ); |
70 |
> |
lineNum++; |
71 |
> |
if( feof( inFile ) ){ |
72 |
> |
fprintf( stderr, |
73 |
> |
"File \"%s\" ended unexpectedly at line %d\n", |
74 |
> |
inName, |
75 |
> |
lineNum ); |
76 |
> |
exit(0); |
77 |
> |
} |
78 |
> |
|
79 |
> |
i = atoi(readBuffer); |
80 |
> |
|
81 |
> |
|
82 |
> |
} |
83 |
|
|
64 |
– |
|
84 |
|
isScanned = 1; |
85 |
|
return nFrames; |
86 |
|
} |