I'm writing a small program in C and I want to have the option of saving data to file and then reading it from that file. The data is BIG, so I want to somehow dynamically write to a file without having to create a new file and copy modified old file into it.
Here's exactly what I want to do: In the first line, I want to have "description" of the data in the form "%s %s %s ... %s \n" where %s is a string and the n'th string describes data in n+1'th line. I want to read the 1'st line of the file, scan for corresponding "description" string, and if it is not present, append it to the first line, and the data corresponding to it after the last line of the file.
The question is - is it possible to "jump" into lines in the file without scanning all the previous lines, and can I somehow read the first line of the file and append something to it after reading? Or maybe it is not the way to go in this situation and C offers some kind of different solution?