Sorry for the subject, I didnt know what else to write. I am doing some silly Qt4 example programs just to learn the framework. In this case the snippet of the program adds lines on a text file. The problem is that sometimes it skips a whole line and sometimes not. It seems to depend on the data to be written:

linux #cat birthday.dat
giovanni12/07/1969
giovanni12/07/1969
giovanni12/07/1969

fabio16/12/1966

fabio16/12/1966

fabio16/12/1966
giovanni12/07/1969
giovanni12/07/1969
giovanni12/07/1969

fabio16/12/1966

fabio16/12/1966

Here are the relevant snippets of the code (they are very short, so please read them):

// file birthday.h

class Birthday
{
public:
explicit Birthday( const QString& );
bool append( const QString&, const QString& );
private:
Birthday() {}
const QString baseName;
};

// file birthday.cpp

bool Birthday::append( const QString& name, const QString& date )
{
QFile file( baseName );
if( !file.open( QIODevice::Append | QIODevice::Text ) )
return false;
QPair<QString, QString> data = qMakePair( name, date );
QDataStream out( &file );
out << data << "\n";
file.close();
return true;
}

// file main.cpp

int main( int argc, char *argv[] )
{
QApplication app( argc, argv );
Birthday bDay( "birthday.dat" );
if( argc > 2 )
{
QStringList args = app.arguments();
if( args.at(1) == "-a" ) {
if( bDay.append( args.at(2), args.at(3) ) )
return 0;
else
return 1;
}
[skip]
}

This issue is driving me mad. Can either anyone explain or is it a bug?
Thanks in advance to anyone who will reply.

fabio