jeudi 2 juillet 2015

How to sort multiple columns: CSV? c++

I am attempting to sort a CSV file by specifying which column order to sort in:

for example: ./csort 3, 1, 5 < DATA > SORTED_DATA

or ./csort 3, 4, 6, 2, 1, 5 < DATA ...

example line of DATA: 177,27,2,42,285,220

I used a vector split(string str) function to store the columns specified in the arguments which require sorting.

Not entirely sure how to proceed with the sorting process; though, I am aware that I could use sort.

sort(v.begin(), v.end(), myfunction);

Aucun commentaire:

Enregistrer un commentaire