Copy?

This is a discussion on Copy? within the C++ Programming forums, part of the General Programming Boards category; I'm writing a console app, and I need to copy a file. I would prefer not to use a ifstream ...

  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
    Registered User
    Join Date
    Oct 2002
    Posts
    291

  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, 03: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, 10:15 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21