|
From: Per W. <pw...@ia...> - 2004-01-14 22:44:52
|
No need to copy one bit at the time. You wan't to copy as large blocks as
possible to keep code efficient. Create a reasonably large buffer - a
reasonably large number n * 4096 should be good - and then read/write
until done. Just notice that the last read/write block might be smaller.
/Per W
On Wed, 14 Jan 2004, Noorez Kassam wrote:
> This is a code that should copy a .exe file. But i'm not sure what function
> call to use to copy one bit at time. Can someone fill it in.
>
> #include <iostream>
> #include <cstdlib>
> #include <fstream>
> #include <string>
> using namespace std;
>
> int main()
> {
> ofstream out_file;
> ifstream in_file;
>
> cout << "Program copyer. The .exe extension will be added for you\n";
>
> char name1[234];
> cout << "Enter name of file: ";
> cin.getline(name1, 234);
> strcat(name1,".exe");
>
> in_file.open(name1, ios::binary);
> out_file.open("newfile.exe",ios::binary);
>
> //code needed hear
>
> system("pause");
> }
>
> _________________________________________________________________
> Add photos to your e-mail with MSN 8. Get 2 months FREE*.
> http://join.msn.com/?page=features/photos&pgmarket=en-ca&RU=http%3a%2f%2fjoin.msn.com%2f%3fpage%3dmisc%2fspecialoffers%26pgmarket%3den-ca
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Perforce Software.
> Perforce is the Fast Software Configuration Management System offering
> advanced branching capabilities and atomic changes on 50+ platforms.
> Free Eval! http://www.perforce.com/perforce/loadprog.html
> _______________________________________________
> Dev-cpp-users mailing list
> Dev...@li...
> TO UNSUBSCRIBE: http://www23.brinkster.com/noicys/devcpp/ub.htm
> https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
>
|