I'm really new to Qt programming and still learning. I am looking for Qt equivalent of this code:
Qt Code:
  1. #include <iostream>
  2. #include <string>
  3. #include <fstream>
  4.  
  5. using namespace std;
  6.  
  7. int main() {
  8. int i = 0;
  9. string name[3], age[3];
  10. ifstream FileRead("stu.txt");
  11. while(FileRead >> name[i] >> age[i]) {
  12. cout << name[i] << "\t" << age[i] << endl;
  13. i++;
  14. }
  15. FileRead.close();
  16. return 0;
  17. }
To copy to clipboard, switch view to plain text mode 

The main function of this code is that I want to read the file word by word and store the words into a particular array of strings.

My file (stu.txt) contains the data:
name1 age1
name2 age2
name3 age3
and I want to store the "name1" into name[0] and "age1" into age[0].

Is there an easy way I can do the same in Qt using QString, QFile etc?