Path: utzoo!attcan!ncrcan!scocan!jfischer From: jfischer@sco.COM (Jonathan A. Fischer) Newsgroups: comp.lang.c++ Subject: Re: Help: input/output thru' command line parameters Keywords: input, output, files Message-ID: <1990Dec03.154003.11495@sco.COM> Date: 3 Dec 90 15:40:03 GMT References: <2530@clyde.concordia.ca> Sender: news@sco.COM (News administration) Organization: SCO Canada, Inc. Lines: 32 Many people might be interested in the answer, so I'm posting as well as responding (not to mention that it's rather poor net etiquette to say "just respond to me, I can't be bothered reading this newsgroup for the next couple of days"). Redirecting cin/cout is simple: ifstream infile( "infile" ); ofstream outfile( "outfile" ); cin = ifstream; cout = ofstream; cin >> something; // Comes from infile cout << something; // Goes to outfile If you want to restore cin and cout after doing the redirection, you can do the following: istream_withassign save_cin; ostream_withassign save_cout; save_cin = cin; save_cout = cout; // Redirect cin and cout // ... // Restore cin and cout cin = save_cin; cout = save_cout; Brought to you by Super Global Mega Corp .com