PDA

View Full Version : How to make a very long [8000X1] dynamic table?



lucie1985
1st August 2015, 21:58
Hello People, please need some help again.
I have a file.txt with 8000 Lines and try to copy each lines in a dynamic [8000X1] Table.
The operation crashs because the number of rows is very long. A file with just 700 lines makes no problem.
I need please some help :) .


window.h
QString *inputFileTableDATA;


window.cpp
QFile Fileout(file);
if (!Fileout.open(QIODevice::ReadOnly|QIODevice::Text ))
MessageBox::critical(this,"Problem","The file could not be found!");
else
{
int LinetotaL=0;
int NbrOfLine=8000;
QTextStream File_lines(&Fileout);
QString mylines = File_lines.readLine();

inputFileTableDATA = new QString [NbrOfLine];
while (!mylines.isNull())
{
mylines = File_lines.readLine();
inputFileTableDATA[LinetotaL]=mylines; ___<-------------------------//simulation stops here
LinetotaL++;
}

}

Lesiok
2nd August 2015, 07:53
I think that file have more then 8000 lines and You are reading to the end of file not 8000 lines.
Why You don't use some dynamic structure like QVector or QList ?

lucie1985
2nd August 2015, 12:09
Okay.. thank you Lesiok,
I dont really know how QVector/Qlist works , but i will try it tomorrow at the work :) .
Than u ;)