sorting csv file

  • Hi,

    I would like to sort big csv files according to some columns.
    For example, I have a file with the following format :
    Which I would like to sort the lines in the following order: lastname then firstname.

    Is the stxxl library an appropriate tool for doing that?
    If so, how should I proceed ?

    I am not really familiar with I/Os in C++.
    I made the examples work but I do not really know how to adapt them for my problem.

    Could you help me, please ?
    Thank you.

    • Hi,

      csv files have fields with variable lengths. Unfortunately, stxxl can not deal with variable-length records. You can still sort string fields if there is a bound on their length, e.g. use "char str[MAX_LENGTH]" type to store them. See also

      With best regards,