A naïve approach would be:
  1. Open input file and output file: QFile::open()
  2. Read a line from the input file: QFile::readLine() or QTextStream::readLine()
  3. Split the line on the comma character: QString::split()
  4. Check the fields and if the line is to be kept write it to the output file: QFile::write() or QTextStream operator <<
  5. Repeat from 2 until input file exhausted
  6. Close files
  7. On successful completion replace input file with output file


However, "CSV File" covers a multitude of slightly different formats: quotes, no quotes, embedded commas, embedded new lines etc. More complex handling is required for many of these scenarios.