I´m developing a Ubuntu application with QT Creator in c++ language and i have a problem when my system shutdowns suddenly. I´m constantly modifying some files and when my system shutdowns doesn´t save the last changes but it add several "0" chars at the last line. I always make flush and close the file but anyway i have the problem.
Anybody can help me?
This is my code:
AddItemLog(unsigned char Index,QString Cadena)
{
QFile File(FileNames[Index]);
File.open(QIODevice::ReadWrite | QIODevice::Append);
QTextStream Stream(&File);
Stream << GetStringDate(false) << ": " << Cadena.toUtf8() << endl;
File.flush();
File.close();
}