Hello everyone!
here, iam trying to read all the lines from my file into qt textEdit but iam facing problems in calling the ReadAllWords function and setText!
here is my code, i think iam close, because i did it a long time ago but i totally forgot.
Thanks!
void delete1:n_showlines_clicked()
{
Quizlet quizlet; //creating an object of class Quizlet
//quizlet.ReadAllWords(); //calling the function ReadAllWords
ui->textEdit->setText(quizlet.ReadAllWords());
}
well, this is my code for ReadAllWords function to print all the lines from the file:
vector<string> Quizlet::ReadAllWords() {
// File pointer
fstream fin;
fin.open("words.txt", ios::in);
vector <string> rows;
string line, word, temp;
while (getline(fin, line)) {
rows.push_back(line);
stringstream s(line);
}
return rows;
}
and in another source file i want to call the ReafAllFunction into editText,
i hope this helps
Bookmarks