title: Qt Runtime Error
body: <p>I am using Qt IDE.The following code is causing Microsoft Visual C++ runtime library Error. Moreover the program instead of displaying items with text "NewYork" and "London", displays "NewYork" and "Londonk" and then crashes. here is the code.</p>
  
  <pre><code>void MainWindow::on_listWidget_itemClicked(QListWidgetItem *item)  // creates comments for item
  {
      ui-&gt;listWidget_2-&gt;clear();
  
      ui-&gt;commentbutton-&gt;setEnabled(true);
                                                                                                     QFile files("E:/"+QString::number(ui-&gt;listWidget-&gt;currentRow())+"com.txt");
  
      if(files.exists())
      {
          if(!files.open(QFile::ReadOnly | QFile::Text))
          {
               QMessageBox::warning(this,"File Access!!!","The File containing data of     the Items and Comments can't be acessed",QMessageBox::Ok);
               return;
          }
          QTextStream in(&amp;files);
          QString data(in.readLine());
          int x=0;
  
          QString temp;
  
          for(int i=0;;i++)
          {
              if(i&gt;data.size())
                  break;
  
  
  
              if(data.at(i)!='@' &amp;&amp; data.at(i+1)!='#')
              {
                  temp[x]=data.at(i);
                  x++;
              }
              else
                  if(data.at(i)=='@' &amp;&amp; data.at(i+1)=='#')
                  {
                      QListWidgetItem *itm=new QListWidgetItem;
  
                      x=0;
                      i++;
                      itm-&gt;setText(temp);
                      ui-&gt;listWidget_2-&gt;addItem(itm);
                  }
          }
          files.close();
  }
  </code></pre>
  
  <p>The program generates the Xcom.txt files properly(X is a number). The file from which I am retrieving data contains this </p>
  
  <blockquote>
    <p>NewYork@#London@#.</p>
  </blockquote>