File Copying+Pasting...

This is a discussion on File Copying+Pasting... within the C++ Programming forums, part of the General Programming Boards category; Hi. I have a program that copies several files from a certain directory to another dir...but I realized today that ...

  1. #1
    Registered User Ion Blade's Avatar
    Join Date
    May 2002
    Posts
    35

    Smile File Copying+Pasting...

    Hi.

    I have a program that copies several files from a certain directory to another dir...but I realized today that a friend of mine that uses my program has a completely different dir structure than mine. right now the program just uses system("copy") to copy the files, and i have now realized that if i want my friend to be able to use this program, i am going to have to modify my prog a bit.

    i'm going to change things so that the user can choose what directory to copy the files to (of course using a cin, since this is a console app). however... as far as i know, you can't pass variables to system calls... if i'm wrong on this let me know.

    Now i just need to know how to code copying+pasting files. i know it's something to do with fstreams, but i don't know exactly what. there is a function in my program that i made that checks the existence of the files to copy, which just scans for the filesize and returns positive if the filesize is greater than 0. I know the key to copying files lies in the same method as i used to check their existence... but as i mentioned, i am at a loss as to how to do this. Any help would be greatly appreciated!!
    "Im going to have peaceful dreams of brackets and semicolons strapped on crucifixes, screaming for mercy" - Someone who doesn't like programming.

  2. #2
    Registered User Azuth's Avatar
    Join Date
    Feb 2002
    Posts
    236
    Have a look at the post from Dual-Catfish on the thread below, I haven't tested this, but it looks right to me.

    http://www.cprogramming.com/cboard/s...ghlight=system
    Demonographic rhinology is not the only possible outcome, but why take the chance

  3. #3
    Registered User Ion Blade's Avatar
    Join Date
    May 2002
    Posts
    35
    Thanks... i'm getting to work on a fix for my program right now.
    "Im going to have peaceful dreams of brackets and semicolons strapped on crucifixes, screaming for mercy" - Someone who doesn't like programming.

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. help with text input
    By Alphawaves in forum C Programming
    Replies: 8
    Last Post: 04-08-2007, 04:54 PM
  4. Replies: 3
    Last Post: 03-04-2005, 01:46 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM

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