Code:
void *fp, *empty;
char string[80], *sp, *first_pos, *second_pos, *third_pos, *fourth_pos;
char *qNumber, *qFile, *qLevel, *qTime;
int diff, length, length2, i;
char *qsht = "qsheet.sht";
Ug. That's horrible. A huge mass of globals! You generally should avoid globals whenever possible. Poor design.
Code:
fgets(string, 81, fp);
if(feof(fp)) { break; }
You should test your read for EOF instead of using feof. EOF is the preferred test. Actually, just test the return value of your fgets call.
After all, that's the whole point of having return values...
Additionally, you don't EVER want to make fgets use the full buffer. Pass fgets the exact number the buffer contains, or a number LESS than the buffer. Never ever pass it a number larger than the buffer size. fgets is a safe function. There is no need in going out of your way to intentionally break it.
if( fgets( string, 80, fp ) == EOF ) break;
Code:
rewind(fp);
close(fp);
There is no point in rewinding your file if you're just closing it anyway.
Code:
qNumber = strtok(string, ":");
qFile = strtok(NULL, ":");
qLevel = strtok(NULL, ":");
qTime = strtok(NULL, ":");
There are much better ways to do things than to use strtok. strtok is a lousy function, IMO.
Code:
char* mySheet[4][numOfLines];
This is a two dimensional array of POINTERS. It has NO MEMORY ALLOCATED for it. (It does, but only pointer space.)
Furthermore, unless your compiler uses C99, your declaration of this array is not valid C code. Sure, it may work on your compiler, but it isn't portable. You may not care about portability; but there are much better ways to do this. malloc is your friend.
Additionally, you actually need to malloc some space and copy your strings into them.
I'll stop for now.
Quzah.