Thread: Ios::trunc

  1. #1
    Registered User
    Join Date
    Nov 2005
    Posts
    545

    Ios::trunc

    is it ok to use ios::trunc even if you don't know if the file exists? as I want to write to a new file or re-write an existing one. How would I go about this?

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    ios::trunc
    If the file opened for output operations already existed before, its previous content is deleted and replaced by the new one.
    Seems ok!
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed
Website Security Test