Skip to content

Instantly share code, notes, and snippets.

@jemyzhang
Last active June 15, 2017 02:25
Show Gist options
  • Save jemyzhang/8444529080881a11ddea3ed358fc7514 to your computer and use it in GitHub Desktop.
Save jemyzhang/8444529080881a11ddea3ed358fc7514 to your computer and use it in GitHub Desktop.
#include <fstream>
#include <iterator>
#include <string>
#include <vector>
int main()
{
std::vector<std::string> example;
example.push_back("This");
example.push_back("is");
example.push_back("a");
example.push_back("test");
std::ofstream output_file("./example.txt");
std::ostream_iterator<std::string> output_iterator(output_file, "\n");
std::copy(example.begin(), example.end(), output_iterator);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment