CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 1999
    Posts
    18

    How to modify a file's content?

    I want to change a file's content,such as ,I want to delete or modify a random line of a file.
    How to do this?


  2. #2
    Guest

    Re: How to modify a file's content?

    You can open a second file read from the first and write to the second. In the process you can make your modifications. For example skipping a line etc. When done close second file(with a temporary name), delete the origianl and rename the temp file to the original name. A bit safer than reading the file into memory truncating the file to zero length and writing from memory to file.

    Hope this helps


Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured