CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2016
    Posts
    8

    How to copy the contents of a file into another file multiple times?

    Hi All,

    I have a file, i need to copy the contents of the file into another file with multiple times.

    Example:-

    The file which i have is having the content as "Hello World". i need to copy the content into multiple times into another file say for ex. 5 times. The output i need is something like below in the new file

    Output:-
    Hello World

    Hello World

    Hello World

    Hello World

    Hello World

    Please help me on this.Thanks in Advance!

    Regards,
    Mani

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,877

    Re: How to copy the contents of a file into another file multiple times?

    What have you tried?
    If you do not close the output file, everything that is written to it will go to the end of the file.
    If you close the output file and want to append new data to the end of the file, use a constructor that has the append argument.
    Norm

  3. #3
    Join Date
    Oct 2016
    Posts
    8

    Re: How to copy the contents of a file into another file multiple times?

    Thanks Norm for the reply

    i have used the append argument - true in the code. it's working fine.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured