So, I have a csv file where every row contains a timestamp (UTC) and a sensor reading. I have been trying to leverage the Qt libraries to aid me however, I have been having a lot of trouble. The following is my code
Qt Code:
  1. // Read files until one of the files ends
  2. for (int i=0; i<noOfFiles; i++)
  3. {
  4. QStringList rowVec;
  5. QString value,timestamp,row;
  6. QDateTime timestampH;
  7. while (!(*finVec[i]).eof())
  8. {
  9. string str;
  10. getline(*(finVec[i]),str);
  11. row = QString::fromLocal8Bit(str.c_str());
  12. rowVec = row.split(",");
  13. timestamp = rowVec.at(0);
  14. value = rowVec.at(1);
  15.  
  16. timestampH = QDateTime::fromString(timestamp,"yyyy-MM-dd HH:mm:ss");
  17. timestampH.setTimeSpec(Qt::UTC);
  18.  
  19. cout << timestampH.isNull() << endl;
  20. }
  21. }
To copy to clipboard, switch view to plain text mode 

The result of the code is always such that timestampH is NULL! I am 100% sure that the data in my csv file is the same exact format as "yyyy-MM-dd HH:mm:ss". In fact if I copy and paste a single timestamp into my code replacing the variable (QString timestamp) i dont get any problems. Can someone please help me on this I have tried everything the past 2 days and got no where