[Qt-interest] I am facing a problem

Sean Harmer sean.harmer at maps-technology.com
Wed Aug 12 15:37:27 CEST 2009


The first test is failing as you will have: testNumberOfPoints.at(0) = 2 and 
the test is testNumberOfPoints.at(0) != '0' => ( 2 != 0 ) = true.

This is simple logic and nothing specific to Qt.

Sean

On Wednesday 12 Aug 2009 14:31:27 Sujan Dasmahapatra wrote:
> Dear Friends
> I am facing a problem for this code below.
>
> ///////////////////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////////////////////
>///////////////////////////////////////////////////////////// int
> numberOfPoints = 201;
> QString testNumberOfPoints = QString::number(numberOfPoints);
>  for(i=0; i<testNumberOfPoints.length(); i++)
>         {
>                 qDebug() << testNumberOfPoints.at(i) << "\n";
>                 if(testNumberOfPoints.at(i) != '0' ||
> testNumberOfPoints.at(i) != '1' || testNumberOfPoints.at(i) != '2' ||
> testNumberOfPoints.at(i) != '3' ||
>                 testNumberOfPoints.at(i) != '4' || 
> testNumberOfPoints.at(i) != '5' ||  testNumberOfPoints.at(i) != '6' ||
> testNumberOfPoints.at(i) != '7' ||
>                 testNumberOfPoints.at(i) != '8' || testNumberOfPoints.at(i)
> != '9')
>                 {
>                 QMessageBox msg;
>                 msg.setText("The geomertry file is not a valid .dat
> format");
>                 msg.exec();
>                 return ;
>                 }
>         }
>
> ///////////////////////////////////////////////////////////////////////////
>////////////////////////////////////////////////////////////////////////////
>///////////////////////////////////////////////////////////////// The value
> is 201 you can see but still it's returning !!!
> Can anyone tell me why this is happening ??



More information about the Qt-interest-old mailing list