June 23rd, 2003, 09:03 PM
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 ... =)
June 23rd, 2003, 09:43 PM
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).