> I had a look at C and I can't see how to create an index file,
An index file is just going to be an array of offsets, which you pass to fseek
Normally, you'd store the index file in memory,
Code:
long offset;
int record_num;
// read from a file
fseek( index_file_fp, record_num * sizeof(long), SEEK_SET );
fread( &offset, sizeof(long), 1, index_file_fp );
// or read from an array, which is the in-memory copy of index_file
offset = index_array[record_num];
// then you seek to that offset in the data file, and read/write the record
fseek( data_file_fp, offset, SEEK_SET );
fread( &record, sizeof(record), 1, data_file_fp );
> Also does anyone know of any sorting algorithms.
qsort in stdlib.h is pretty good most of the time