How i an append a file and write at its start

This is a discussion on How i an append a file and write at its start within the C++ Programming forums, part of the General Programming Boards category; Like there is a file in which abcdef is written now i want to wwrite 123 at the start. how ...

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    82

    How i an append a file and write at its start

    Like there is a file in which abcdef is written
    now i want to wwrite 123 at the start.
    how can i do that??

  2. #2
    Registered User manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    Kolkata@India
    Posts
    2,498
    Quote Originally Posted by fredsilvester93 View Post
    Like there is a file in which abcdef is written
    now i want to wwrite 123 at the start.
    how can i do that??
    1. Read what is written on the file and put it in a std::string.
    2. 'Add' the above string to "i23"
    3. Output the result to the file.
    Manasij Mukherjee | gcc-4.8.2 @Arch Linux
    Slow and Steady wins the race... if and only if :
    1.None of the other participants are fast and steady.
    2.The fast and unsteady suddenly falls asleep while running !



  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,293
    What have you tried?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Append one file to another.
    By guillermoh in forum C Programming
    Replies: 6
    Last Post: 02-04-2008, 11:04 AM
  2. file append
    By rahulsk1947 in forum C Programming
    Replies: 2
    Last Post: 10-30-2007, 01:01 AM
  3. append binary file!
    By spank in forum C Programming
    Replies: 2
    Last Post: 01-25-2006, 12:39 PM
  4. Append to a file
    By Queatrix in forum Windows Programming
    Replies: 4
    Last Post: 07-12-2005, 02:12 AM
  5. append file?
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 09-27-2001, 08:37 AM

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