Creating file names automatically C++

前端 未结 5 1387
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 18:41

I\'m trying to write a program in C++, which creates some files (.txt) and writes down the result in them. The problem is that an amount of these files is not fixed at the begin

5条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-04 19:15

    ... another way to bulid the filename

    #include 
    
    int n = 3;
    std::ostringstream os;
    os << "file_" << n << ".txt";
    
    std::string s = os.str();
    

提交回复
热议问题