Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
copying binary files c++
Name: Skr00d Date: August 18, 2003 at 03:28:41 Pacific OS: WinME CPU/Ram: 60
Comment:
i am trying to write a program that can copy a binary file (exe). nothing i have tried has worked, i initially tried to copy the entire file into a character array but i assume binary files use characters that make the compiler prematurely terminate the string. the closest i have come so far is
fstream outfile("write.exe", ios::out|ios::binary|ios::trunc); for (counter=0;counter> x; outfile x; }
where endf is the length of the file to be copied. this almost works but the resultng program makes an illegal error immediately on startup. i have been searching the net for hours and can't figure this one out :(
Name: zeroguy Date: August 18, 2003 at 21:09:30 Pacific
Reply:
I'm not sure if you've already tried this, but I think it would make things a whole lot simpler if you just used a system call like cp for nix, or it's DOS equivelant copy. I *think* you can do that with just SYSTEM("copy [source file] [dest file]"); in DOS, but I'm not sure. Try looking up how to call DOS command-line calls if that doesn't work.
Summary: i want to do the same but its bit diff how do i copy a file from c: to d: for ex open "c:\filename.dat for binary as #1 this file onto d: there is hardly any help in MSDN ...
Summary: Hello, I'm wondering how I could copy and then delete a file in C++. What I want to do is copy a file, then delete the original so that i can encrypt it and name it the original file. then i want to d...
Summary: ============================================================= Text files are essentially binary files that are characters within specific ranges of the ASCII standard. To do this search get a hold o...