I'm writing a large amount of data to a binary file. Trouble is, I don't know how much until the program finishes executing. Given this, I'd like to rewind back to the begining of the binary file and write an element indicating how many records I wrote to the binary file - this way I can create arrays in another program and read in the data to do some fun stuff with it. I've tried: fseek(filename, sizeof(int), SEEK_SET); fwrite(&data, sizeof(int), 1, filename); to no avail. Can someone please assist?