Ofstream file opening parameters

  • std::ios::ate - full file is available for writting and the pointer will be at the end of the file in the beginning.
  • std::ios::app - starts writting at the end of the file and existing porting is non writable.
  • std::ios::trunc - will delete everything in the file and starts writting afresh.
  • std::ios::out - used to creat a file if doesn’t exists, writting behaviour is dependant on trunc or ate etc.
  • std::ios::binary - most useful mode to generate binary files.