Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

read from input file and write to output file

Status
Not open for further replies.

fuku123

Programmer
Oct 21, 2001
1
US
Hi, I want to run a c++ program on unix using input and output redirection to make them read from the appropriate input file and to write the putput to the appropriate output file.
What commands do I type?
example:
Prog.cpp reads from data.dat and writes to a file.

do i write:
g++ prog.cpp -o data.dat
 
Uh? If I've understood you correctly, you need to build it normally (say, you build an exec named prog.exe), and then execute it redirecting its input and output. Like:

$_> prog.exe < data.dat > output_file
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top