Can anyone tell me the error within the following lines:

QString dT;
dT.clear();
dT.append("Force = %1 +/- %2\n").arg(F,0,'f',0).arg(tolF,0,'f',0);

returns

Force = 10 +/- 2

properly on stdout. But when writing to formatted file using

QFile file( repfname );
QTextStream ts( &file );
const char *foo = dT.toStdString().c_str();
ts << foo << endl;
file.close();


file contains

Force = %1 +/- %2