C++, How do I overwrite a .txt file?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Alex T
    New Member
    • Oct 2010
    • 29

    C++, How do I overwrite a .txt file?

    I am trying to overwrite an ifstream file with an ofstream file. How do I do this?
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    If the source file exists before you start writting... delete it.

    Comment

    • mac11
      Contributor
      • Apr 2007
      • 256

      #3
      ofstream constructor allows you to specify truncation mode, see http://cplusplus.com/reference/iostr...ream/ofstream/

      Comment

      Working...