Thread: Swap the file contents

  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    16

    Swap the file contents

    Hi All,

    I would like to swap the contents of two large files without using any temporary file. However, a buffer can be used instead of temporary file. I could swap the file contents, but have a problem in deleting the contents of the larger file at the end.

    Please help resolve this problem.

    Thanks in advance

  2. #2
    Registered User
    Join Date
    May 2006
    Posts
    903
    Why don't you just swap the names ?

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    16
    Great idea ! I need to improve my thinking.

    Thanks a lot

    There is a problem in opening the link.

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    16
    Quote Originally Posted by Desolation
    Why don't you just swap the names ?
    Thanks Desolation for your suggestion.

    Do we have any other solutions apart from renaming the files?

    Thanks in advance.

  5. #5
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Just like swapping anything else. A to C, B to A, C to B.


    Quzah.
    Hope is the first step on the road to disappointment.

  6. #6
    pwns nooblars
    Join Date
    Oct 2005
    Location
    Portland, Or
    Posts
    1,094
    If you dont want a temporary file, and they are too large for a buffer, A = smaller file, B = larger file, C = the end of the B file (save the offset).

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. Formatting a text file...
    By dagorsul in forum C Programming
    Replies: 12
    Last Post: 05-02-2008, 03:53 AM
  3. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  4. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM