Hi Cliff:
Would you, (or anybody else) critique this and tell me if I should be
proud of my progress?
//copyfil2.cpp
#include
#include
void main(int argc, char *argv[])
{
if(argc != 3)
{
cerr << "\nUse Arguments";
exit(1);
}
char ch;
ifstream infile; ofstream outfile;
infile.open(argv[1]); // I know I should stick in cerr
outfile.open(argv[2]); // on both of these calls.
while(infile.get(ch) != 0)
{
outfile.put(ch);
}
}
//-------------------------------------------------------------
It compiles and copies one text file to another.
If this is correct, my next project is to try to process each line
in such a way that I can delete it ' i.e. NOT write the line to the
destination text file. Or else designate a block of lines to skip
over.
Any comments will be appreciated. The enormous array of choices in
dealing with streams in C++ is a little confusing as I am doing it without
having learned C very much.
Sincerely,
Frank
--- FMail/386 1.02
---------------
* Origin: Maybe in 5,000 years frankmas@juno.com (1:396/45.12)
|