csv_write

View page source

Write a Csv File

Prototype

   void csv_write(
      const std::string& file_name ,
      const vec_vec_str& csv_table )

vec_vec_str

see vec_vec_str .

file_name

is the name of the csv file. The rows in this file are separated by newlines '\n' and the columns are separated by commas ',' . There are no other special characters in this file.

csv_table

  1. The j-th column of the i-th row of the file contains the value csv_table[i][j] .

  2. 0 < csv_table[i].size() for all row indices i .

  3. The character ',' is added between columns.

  4. The character '\n' is added at the end of every line.

Example

xam_csv_write.cpp contains an example and test of this routine.