Thread: copy jpg

  1. No Profile Picture
    Average Intelligence
    Devshed Novice (500 - 999 posts)

    Join Date
    Apr 2003
    Rep Power

    copy jpg

    I can't seem to find any source code that has this done already. Apparently this will be a bitch since it's not in binary mode? is that right?

    Has anyone ever used C++ to copy a jpg file to another location on the computer? And if so can source code be pointed at for me or even just the copy command or what? I've seen some stuff but it was way over my head with 20 different module's and whatnots... there really has got to be an easy way to do it, and if not, can you tell me what language would it be easy in ... =)
  2. #2
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Rep Power
    All files are binary (even text files, for that matter). If you want a byte for byte copy of a file, it doesn't matter what its format is. Simply read in every byte of the source file, and write out every byte - exactly as is - to the destination file. Make sure you read it as binary, which means you read it into memory exactly as is, and write it out exactly as is. That's all a file copy command basically does.

    You can speed up the process by reading in as much as the file as possible before writing it out so there isn't a significant amount of disk activity to go back and forth (if you are copying it to the same drive).

IMN logo majestic logo threadwatch logo seochat tools logo