Thread: Editing a text file

  1. #1
    Registered User
    Join Date
    Nov 2009

    Editing a text file

    How do you edit a text file in c++, I know how to open and view files, but not edit them.

    Thank you.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    - Read in the text
    - make some changes (say search and replace)
    - write the file
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Unregistered User Yarin's Avatar
    Join Date
    Jul 2007
    You don't "edit" text files in C++, per se. You would read it, modify the content, then completely re-write the file.

    A quick google search turned up some promising results: C++ file i/o tutorial - Google Search
    I just want to use my computer in a productive manner, not learn how to use it. Elysia
    A year spent in artificial intelligence is enough to make one believe in God. Alan Jay Perlis

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. A development process
    By Noir in forum C Programming
    Replies: 37
    Last Post: 07-10-2011, 10:39 PM
  2. Help with searching text file
    By zacharyrs in forum C Programming
    Replies: 30
    Last Post: 12-01-2009, 03:13 PM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 05:02 AM
  4. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  5. what does this mean to you?
    By pkananen in forum C++ Programming
    Replies: 8
    Last Post: 02-04-2002, 03:58 PM