C++ code: 将程序的输出,保存到txt文档中,且每35个数,自动换行

  // write the predicted score into txt files
      ofstream file("/home/wangxiao/Downloads/caffe-master/wangxiao/bvlc_alexnet/predict_score.txt",ios::app);
      if(!file) return;
      static int nu = 0;
      if(nu < 35){
        file << bottom_data[id_tmp] << " " ;
        nu ++;
      } else {
        nu = 0;
        file << " " << endl;  // endl denotes change into next line in the C++ language
      }
      file.close();

posted @ 2016-03-09 16:33  AHU-WangXiao  阅读(850)  评论(0编辑  收藏  举报