The easiest way is to use objects of type ofstream for output and ifstream for input. And then send filenames in the constructor. For example ifstream fin(“input.txt”). The syntax is exactly the same as in cin and cout. To use these types you have to include the header file fstream.
Comments
Leave a comment