首页 新闻 会员 周边

C++Builder 6.0下的程序怎样与C++Builder XE兼容?

0
悬赏园豆:20 [已关闭问题] 关闭于 2013-08-26 16:13
//---------------------------------------------------------------------------

#include <vcl.h>
#include <iostream.h>
#include <fstream>
#include <string>

#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
    : TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
  this->OpenDialog1->FileName ="*.inp";
  this->OpenDialog1->Title="打开lxly.inp文件";
  if(this->OpenDialog1->Execute())
  {
     string str,str1,str2,str3,str4,str5,str6,str7;
     ifstream inf(this->OpenDialog1->FileName.c_str());
     for(int i=1;i<=4;i++)
     {
        getline(inf,str);
        this->CheckListBox1->Items->Add(str.c_str());
     }

         this->ProgressBar1->Min =5;
             this->ProgressBar1->Max =83650;
             int k=5;
             TStringList *ttt=NULL;
             ttt=new TStringList();

             while(!inf.eof())
             {
               inf>>str1>>str2>>str3>>str4>>str5>>str6>>str7;
               this->CheckListBox1->Items->Add((str1+" "+str2).c_str());
               ttt->Add((str1+" "+str2).c_str());
               k++;
               this->ProgressBar1->Position=k;
               }
               this->CheckListBox1->Items =ttt;

     inf.close();
}
  }
//---------------------------------------------------------------------------

以上代码在C++builder 6下可以编译通过,且有效,但在C++Builder XE4下也可以编译通过,但无效,即在checklistbox中没有数据出现。

     请告诉原因,并告诉如何改正,(注:不要用Memo等控件直接读取原文件)

向北方的主页 向北方 | 初学一级 | 园豆:154
提问于:2013-08-19 18:15
< >
分享
所有回答(1)
0

没有人知道,关贴了。

向北方 | 园豆:154 (初学一级) | 2013-08-26 16:13
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册