adding text to a file witout deleting the text in file

This is a discussion on adding text to a file witout deleting the text in file within the C++ Programming forums, part of the General Programming Boards category; I know how to add text to a file in C but it deletes everthing in the file im adding ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    10

    Thumbs down adding text to a file witout deleting the text in file

    I know how to add text to a file in C but it deletes everthing in the file im adding it to, how would i do it so it adds a new line were i tell it to?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    Try to open the file in append mode.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Hamster without a wheel iain's Avatar
    Join Date
    Aug 2001
    Posts
    1,385
    if you use the fopen change the ios:ut

    to ios::app

    you can then add to the end of the file
    Monday - what a way to spend a seventh of your life

  4. #4
    Unregistered
    Guest

    ho can I

    delete a txt file all together??

  5. #5
    . Driveway's Avatar
    Join Date
    May 2002
    Posts
    469
    remove("readme.txt"); I think

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. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM
  4. System
    By drdroid in forum C++ Programming
    Replies: 3
    Last Post: 06-28-2002, 10:12 PM
  5. Outputting String arrays in windows
    By Xterria in forum Game Programming
    Replies: 11
    Last Post: 11-13-2001, 06:35 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21