For writing, it's still overwriting the text at the start of the file for some reason. Code below:
{
qint64 fileSize = file.size();
file.seek(fileSize());
stream << new_entry << endl;
// file.write(new_entry+"\n");
file.close();
}
QFile file(filename);
if (file.open(QIODevice::ReadWrite | QIODevice::Append | QIODevice::Text))
{
qint64 fileSize = file.size();
file.seek(fileSize());
QTextStream stream(&file);
stream << new_entry << endl;
// file.write(new_entry+"\n");
file.close();
}
To copy to clipboard, switch view to plain text mode
For reading in values, it just doesn't populate the combo box at all. Code below:
{
while (!(in.atEnd()))
{
ui->pic_cbox->addItem(entry);
entry = in.readLine();
}
ui->pic_cbox->addItem(entry);
file.close();
}
QFile file(filename);
if (file.open(QIODevice::ReadOnly))
{
QTextStream in(&file);
QString entry = in.readLine();
while (!(in.atEnd()))
{
ui->pic_cbox->addItem(entry);
entry = in.readLine();
}
ui->pic_cbox->addItem(entry);
file.close();
}
To copy to clipboard, switch view to plain text mode
Thank you for your help!
Bookmarks