error C2102: '&' nécessite une l-value



Hello,

I defined the function getDataFile() in order to keep the content of a file in a variable QString like this:

1
2
3
4
5
6
7
8
9
10
11
12
QString getDataFile(QString in_sNomFic)
{
      QString sData="";
      QFile SFile(in_sNomFic);
      if (SFile.open(QIODevice::ReadOnly))
      {
            QByteArray SBuffer = SFile.readAll();
            SFile.close();
            sData = QString(SBuffer);
      }
      return sData;
}



In another function, i call the function getDataFile() to keep the content of the file in a pointer of type unsigned char[]

1
2
3
4
5
QString sFileName, sDataFile;
sFileName = "d:\\myDebug1.xml";
sDataFile = getDataFile(sFileName);
in_pucInfosRetour = &sDataFile.toAscii().constData();


and when compiling i have this error:

error C2102: '&' nécessite une l-value

Thank you for your help

Regards.

Motti
Topic archived. No new replies allowed.