天天看點

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();