|
From: P.D. v. Z. <pd...@xs...> - 2004-01-14 20:25:04
|
Oops... the code also has some old comments in it ... I based it on some
other code I had lying around which read words from a file into a vector,
sorted them, and output only the unique words in alphabetical order... so
ignore the comments :D
Actually 'borrowed' that code from Stroustrup, I believe it was somewhere in
"The C++ Programming Language"... very elegant way of using iterators and
streams... too bad I couldn't use it for this problem (the formatted
input/output operators are used like that, which yields incorrect results
for binary files).
Paul
-----Original Message-----
From: dev...@li...
[mailto:dev...@li...] On Behalf Of Noorez
Kassam
Sent: Wednesday, January 14, 2004 7:59 PM
To: dev...@li...
Subject: [Dev-C++] File Handling
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%2fjoi
n.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
|