I have a large vector.
The ways that I use multiply the run-time of the program hugely. The first is write all values to a string as they are calculated using
Assuming you have C++11:
#include #include #include int main() { std::vector v{ "one", "two", "three" }; std::ofstream outFile("my_file.txt"); // the important part for (const auto &e : v) outFile << e << "\n"; }