I am trying to output to a certain line in a file using ofstream. My file is automatically loaded with certain numbers, and I need to exchange one number at a time. For example, it originally outputs:

2400
0000
0000
0000

2500
0000
0000
0000

and I need to change it to:

2400
0000
0000
0000

2500
0000
1700
0000

I originally thought to use seekp, but I cannot seem to make it work correctly. Any ideas?