Thread: Copy?

  1. #1
    Registered User
    Join Date
    Sep 2002
    Posts
    417

    Copy?

    I'm writing a console app, and I need to copy a file. I would prefer not to use a ifstream and ofstream, but I will if I have to.

    I know there is a rename() and a remove() that can be used... is there a single function that would do copy()?

  2. #2

  3. #3
    Registered User
    Join Date
    Sep 2002
    Posts
    417
    I already know the method. I asked if there was a function.

  4. #4
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>I asked if there was a function.
    Not unless you write it yourself :-)
    *Cela*

  5. #5
    Registered User
    Join Date
    Sep 2002
    Posts
    272
    If you're making a Win32 console app then CopyFile will work. Or it you want a simple C++ method -

    ifstream i("file1");
    ofstream o("file2");
    o << i.rdbuf();
    Joe

  6. #6
    Registered User
    Join Date
    Sep 2002
    Posts
    417
    Many thanks!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. copy = concatenate ?
    By Arruba in forum C Programming
    Replies: 3
    Last Post: 11-03-2006, 04:54 PM
  2. calling copy constructor from template
    By Ancient Dragon in forum C++ Programming
    Replies: 3
    Last Post: 09-28-2005, 01:54 PM
  3. dynamic memory alloccation & returning objects
    By haditya in forum C++ Programming
    Replies: 8
    Last Post: 04-21-2005, 11:55 PM
  4. Copy constructors and operator=()
    By filler_bunny in forum C++ Programming
    Replies: 13
    Last Post: 08-25-2003, 07:43 AM
  5. Copy Constructor Help
    By Jubba in forum C++ Programming
    Replies: 2
    Last Post: 11-07-2001, 11:15 AM