Skip to content

MurakamiShun/justcsv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

justcsv

C++20 CSV(Character Separated Values) headre only writer

example

code

#include "justcvs.hpp"
#include <ofstream>
#include <vector>

struct material{
    int id;
    std::string name;
    float density;
    float conductivity;
    float melting;
};

int main(){
    const std::vector<material> materials = {
        {0, "silver"  , 10.5, 62.9,  960},
        {1, "gold"    , 19.3, 42.6, 1063},
        {2, "copper"  ,  8.9, 57.5, 1083},
        {3, "alminium",  2.7, 32.9,  660}
    };
    std::ofstream ofs("out.csv");
    ofs << jcsv::format(materials, jcsv::cfg{.split = ',', .header = true}) << std::endl;
    ofs.close();
}

output

id,name,density,conductivity,melting
0,silver,10.5,62.9,960
1,gold,19.3,42.6,1063
2,copper,8.9,57.5,1083
3,alminium,2.7,32.9,660

License

This software is released under the MIT License, see LICENSE.

About

C++20 CSV(Character Separated Values) writer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages