Thread: How i an append a file and write at its start

  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
    [](){}(); manasij7479's Avatar
    Join Date
    Feb 2011
    Location
    *nullptr
    Posts
    2,657
    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.

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    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, 12:04 PM
  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, 01: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