Overwrite a file's contents
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Overwrite a file's contents

  1. #1
    Join Date
    Oct 2004
    Posts
    206

    Question Overwrite a file's contents

    Hi,

    Can anybody suggest away to completely overwrite the contents of a text file with some new text?

    Thanks very much,

    dlarkin77

  2. #2
    Join Date
    Dec 2004
    Location
    Ann Arbor, MI
    Posts
    281

    Re: Overwrite a file's contents

    Code:
    CStdioFile fl;
       if(fl.Open("C:\\temp\\MyFile.txt", CFile::shareExclusive | CFile::modeWrite | CFile::modeCreate))
       {
         fl.WriteString("My New Text!\n");
          fl.Close();
       }
    --EJMW

  3. #3
    Join Date
    Oct 2004
    Posts
    206

    Thumbs up Re: Overwrite a file's contents

    Thanks very much ejmw. Much appreciated.

    dlarkin77

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center