Getting datas from queue to series
-
wrote on 6 Jan 2021, 08:47 last edited by
Hi. I have a txt file. I read txt and add datas into a queue.
I want to create a char so, i should get datas from queue and put datas into series.
How can i get datas from queue and add them into series?double num = entry.toDouble(); qDebug()<<num; queue.enqueue(num); // I add datas into a queue
while(!queue.isEmpty()) { series->append(queue,queue); //no matching member function for call to append }
-
Hi. I have a txt file. I read txt and add datas into a queue.
I want to create a char so, i should get datas from queue and put datas into series.
How can i get datas from queue and add them into series?double num = entry.toDouble(); qDebug()<<num; queue.enqueue(num); // I add datas into a queue
while(!queue.isEmpty()) { series->append(queue,queue); //no matching member function for call to append }
wrote on 6 Jan 2021, 08:54 last edited by@suslucoder
Assuming you have aQQueue<double> queue;
, something like:double x = queue.dequeue(); double y = queue.dequeue(); series->append(x, y);
-
@suslucoder
Assuming you have aQQueue<double> queue;
, something like:double x = queue.dequeue(); double y = queue.dequeue(); series->append(x, y);
wrote on 6 Jan 2021, 09:05 last edited by deleted286 1 Jun 2021, 09:10Assuming you have a
QQueue<double> queue;
, something like:Yes, i have it. It works. When i run my code it gives an error: ASSERT: "!isEmpty()" in file C:/Qt/5.15.2/mingw81_64/include/QtCore/qlist.h, line 361
And the program has unexpectedly finished. What might be the reason?
Edit: I guess my queue is empty. I try to add datas to series from an empty queue.
Is it wrong for add datas into a queue like as follows:
QFile file("C:/Users/ilknu/Documents/SnDeneme/deneme.txt"); if (file.open(QIODevice::ReadOnly)) { QTextStream in (&file); while (!in.atEnd()) { QString line = in.readLine(); //queue.enqueue(line); QStringList list = line.split(QLatin1Char(' '), Qt::SkipEmptyParts); for(const QString &entry : list) { double num = entry.toDouble(); qDebug()<<num; queue.enqueue(num);
-
Assuming you have a
QQueue<double> queue;
, something like:Yes, i have it. It works. When i run my code it gives an error: ASSERT: "!isEmpty()" in file C:/Qt/5.15.2/mingw81_64/include/QtCore/qlist.h, line 361
And the program has unexpectedly finished. What might be the reason?
Edit: I guess my queue is empty. I try to add datas to series from an empty queue.
Is it wrong for add datas into a queue like as follows:
QFile file("C:/Users/ilknu/Documents/SnDeneme/deneme.txt"); if (file.open(QIODevice::ReadOnly)) { QTextStream in (&file); while (!in.atEnd()) { QString line = in.readLine(); //queue.enqueue(line); QStringList list = line.split(QLatin1Char(' '), Qt::SkipEmptyParts); for(const QString &entry : list) { double num = entry.toDouble(); qDebug()<<num; queue.enqueue(num);
wrote on 6 Jan 2021, 09:24 last edited by@suslucoder said in Getting datas from queue to series:
Edit: I guess my queue is empty. I try to add datas to series from an empty queue.
Yes, doubtless you are trying to
dequeue
from an empty queue! You cannotdequeue
more then you haveenqueue
d. Yourenqueue()
is fine. You will need something like:while (!queue.isEmpty()) { double num = queue.dequeue(); .... }
-
@suslucoder said in Getting datas from queue to series:
Edit: I guess my queue is empty. I try to add datas to series from an empty queue.
Yes, doubtless you are trying to
dequeue
from an empty queue! You cannotdequeue
more then you haveenqueue
d. Yourenqueue()
is fine. You will need something like:while (!queue.isEmpty()) { double num = queue.dequeue(); .... }
wrote on 6 Jan 2021, 11:13 last edited by@JonB Thank you, it works
1/5