I am guessing you want to insert in the middle of two datasets in order to maintain a sorted order. One solution: you open the file, iterate through the datasets until you reach the preceding dataset whose successor will be the new data you want to insert. Mark the point.
Next save all the succeeding datasets after that point in any apt container-with ordering maintained- and insert the new data at the head of the container. Write the entire content of the container to the file beyond the earlier marked point.
FILE or fstream. It doesn't really matter if you know what you're doing. However, I would suggest the latter since it offers more functionality and ease of use.