Hi guys,

I have a question regarding get data from readLine() function.

Currently, my function read line by line from a text file.
Each line has two numbers with a space between them. (eg. 234.23 454.32).
Is there a way to get those two number separately?

Here is my code.
Qt Code:
  1. bool getInfo(QString fileName) {
  2. QFile myFile(fileName);
  3. if(!myFile.exists()){
  4. qDebug()<<"The file"<<myFile.fileName()<<"does not exist.";
  5. return false;
  6. }
  7. if(!myFile.open(QIODevice::ReadOnly | QIODevice::Text)){
  8. qFatal("Could not open the file");
  9. return false;
  10. }
  11.  
  12. QTextStream st(&myFile);
  13.  
  14. while (!st.atEnd()){
  15. QString text;
  16. text=st.readLine();
  17. qDebug() << text;
To copy to clipboard, switch view to plain text mode 

In the code each line is stored in text and displayed by qDebug(). I would like to also display each numbers in a line sperately like x value is 234.23 and y value is 454.32.

Any idea?