Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Duplicate a file?

Duplicate a file?

Scheduled Pinned Locked Moved C / C++ / MFC
jsonquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcgahanfl
    wrote on last edited by
    #1

    How do you duplicate a file? Is there a windows API? Or do you just use CFile to read it in and create a new copy? Thanks for the insight.

    T T 2 Replies Last reply
    0
    • M mcgahanfl

      How do you duplicate a file? Is there a windows API? Or do you just use CFile to read it in and create a new copy? Thanks for the insight.

      T Offline
      T Offline
      Tom Wright
      wrote on last edited by
      #2

      Try CopyFile or CopyFileEx here is the description: BOOL CopyFile( LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists ); Tom Wright tawright915@yahoo.com

      M 1 Reply Last reply
      0
      • M mcgahanfl

        How do you duplicate a file? Is there a windows API? Or do you just use CFile to read it in and create a new copy? Thanks for the insight.

        T Offline
        T Offline
        Tom Archer
        wrote on last edited by
        #3

        In addition to what Tom said, I would also suggest looking at the MakeSureDirectoryPathExists function if you need to copy the file to a specific folder hierarchy. (This function is in the dbghelp.dll, which you'll need to distribute depending on the target OS - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/makesuredirectorypathexists.asp) Cheers, Tom Archer - Archer Consulting Group
        "Eat your brussel sprouts, Junior. There are starving Chinese children American programmers that would kill for that food!"

        M 1 Reply Last reply
        0
        • T Tom Wright

          Try CopyFile or CopyFileEx here is the description: BOOL CopyFile( LPCTSTR lpExistingFileName, LPCTSTR lpNewFileName, BOOL bFailIfExists ); Tom Wright tawright915@yahoo.com

          M Offline
          M Offline
          mcgahanfl
          wrote on last edited by
          #4

          Thank you. That was right on the money.

          1 Reply Last reply
          0
          • T Tom Archer

            In addition to what Tom said, I would also suggest looking at the MakeSureDirectoryPathExists function if you need to copy the file to a specific folder hierarchy. (This function is in the dbghelp.dll, which you'll need to distribute depending on the target OS - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/makesuredirectorypathexists.asp) Cheers, Tom Archer - Archer Consulting Group
            "Eat your brussel sprouts, Junior. There are starving Chinese children American programmers that would kill for that food!"

            M Offline
            M Offline
            mcgahanfl
            wrote on last edited by
            #5

            Thank you

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups