TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CLIFF RHODES
from: FRANK MASINGILL
date: 1997-05-27 16:18:00
subject: Textfile to another

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)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.