@Pablo Santa Cruz offers a great way, but in C. If you prefer pure C ++, here's how:
- Open file: fstream :: open (do not forget to use the binary flag)
- Set the position of the put pointer: fstream :: seekp
- Write the data to the pointer position: fstream :: put
- Close file: fstream :: close
This is by no means better than version C.
source
share