zoukankan      html  css  js  c++  java
  • 输出string vector到file

    #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, "
    ");
        std::copy(example.begin(), example.end(), output_iterator);
    }
    http://stackoverflow.com/questions/6406356/writing-vector-values-to-a-file
  • 相关阅读:
    POJ 2136
    POJ 2121
    POJ 2127
    POJ 2126
    POJ 2109
    POJ 2105
    POJ 2101
    POJ 2075
    Uboot — 配置过程
    Uboot — 编译体验
  • 原文地址:https://www.cnblogs.com/minggoddess/p/4685566.html
Copyright © 2011-2022 走看看