Writing and reading from file error
-
hii..i have a strange error here and i don't know what is the problem...i write into a file using this code:
@if(File->open(QIODevice::ReadWrite | QIODevice::Text))
{
//File->write("al 7amdlelaah =)");
QTextStream fout(File);
for(int i=0;i<Listpointer->size();++i)
{
fout<<Listpointer->at(i)<<"\n";} File->flush(); File->close(); }@
and the read from the same file using this code:
@if(RunFile.open(QIODevice::ReadWrite |QIODevice::Text))
{
QStringList list;
QTextStream in(&RunFile);
while(!RunFile.atEnd())
{
QString line = in.readLine();
list.append(line);
}
ui->listWidget->addItems(list);
//RunFile->close();
}@
the problem that it read only the first line and ignore other lines...i don't know what is the problem thx in advance =) -
ok i got my mistake..it is
@
While(!in.atEnd())
@
:D:D[EDIT: fixed code, no bold or other visual formatting, Volker]