Hi, I havent had much experience with doing random access with fwrite so I'm getting this problem with it. When I write some information to a specific point within the file, it seems to end the file straight after the data I've just written and I lose the rest of the file??..
Heres the code..
Heres the code..
Code:
static bool writeRow(struct Table* table, int pos, void* buffer, int size) {
long location;
FILE *fp;
location = table->header->headerSize + (pos * table->header->rowSize);
if ((fp = fopen(table->path, "wb+")) != NULL) {
fseek(fp, location, SEEK_SET);
fwrite(buffer, size, 1, fp);
fclose(fp);
} else
return false;
}