Question about creating files

I need to write a program that reads values from an external file. I am creating the file using Notepad, but in putting in values do I need to separate the values by any symbol like a semicolon? Or is it sufficient to put the values on separate lines?

First you have to include the <fstream> library:
#include <fstream>

Then define it:
ofstream out_stream;
ifstream in_stream;

Then create your string that will be written to the file:
string name;

Finally, ask the user to input the name and open your out_stream:
out_stream << name << "\n";

This was in xcode c++, there might be some small syntax changes in visual c++ that you can figure out easily.
Topic archived. No new replies allowed.