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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

saving, writing, and opening files

Status
Not open for further replies.

denisfinn

Programmer
Jun 7, 2003
49
US
i'm not sure if i'm way over my head but....

could someone tell me what is needed to be able to create files from a c++ program....

for example: write a program that takes input and then can save to file.txt

i don't think this should be too hard to do....

also i'd love to be able to open and write files that already exist with this program.

hopefully this won't be impossible

thanks

DF
 
Its not too bad. Just include <fstream> and use an ifstream object to read from a file and an ofstream object to output to a file. If you know how to output and input using cout and cin, then a file stream follows basically the same syntax. Look up file streams in your C++ book.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top