tfile_o.cpp - numeric - C++ library with numerical algorithms
 (HTM) git clone git://src.adamsgaard.dk/numeric
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
       tfile_o.cpp (554B)
       ---
            1 #include <iostream>
            2 #include <fstream>
            3 #include <vector>
            4 #include "header.h"
            5 
            6 // Write arrays to text file, readable by plotting tools
            7 int write_output(const std::vector<Floattype> &a, 
            8                      const std::vector<Floattype> &b, 
            9                  const char *outfile)
           10 {
           11   std::ofstream outstream;
           12 
           13   // Open outfile for write
           14   outstream.open(outfile);
           15 
           16   // Write output arrays in two columns
           17   for (Lengthtype i=0; i<(Lengthtype)a.size(); ++i)
           18     outstream << a[i] << '\t' << b[i] << '\n';
           19 
           20   // Close file
           21   outstream.close();
           22 
           23   // Return successfully
           24   return 0;
           25 }