全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1807
推到 Plurk!
推到 Facebook!

以StringGrid載入過多的資料出現 Acess Violation at address....訊息

尚未結案
s123456
一般會員


發表:8
回覆:1
積分:1
註冊:2006-08-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-08-18 17:43:10 IP:59.104.xxx.xxx 訂閱

各位工程師大大們好 小弟是初入行的軟體工程師 最近在寫 StringGrid載入txt中資料的程式

但發現若載入的資料過多,或反覆的載入資料 會出現 :

Access violation at address 32665A01 in module 'CC3260MT.DLL'. Read of address F87ADB14

的訊息 想請問各位大大這是什麼函意呢? 可以建議我要如何解求呢? 謝謝!

以下是我的程式碼:

=====================================================================================

//---------------------------------------------------------------------------

#include
#include
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
char Buf[500];
char *FileName;
char *ModelNo;
char *EquipmentNo;
char *BinGrade;
char *WaferID1;
char *Qty1;
char *TChip;
char *Rvlw;
char *Rvlw1;
char seps[]=":,.csv";
char seps1[]="Avg,";

//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------


void __fastcall TForm1::ScrollBar1Change(TObject *Sender)
{
StringGrid2->Left=-108-ScrollBar1->Position;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::DriveComboBox1Change(TObject *Sender)
{
DriveComboBox1->DirList=DirectoryListBox1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::DirectoryListBox1Change(TObject *Sender)
{
DirectoryListBox1->FileList=FileListBox1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button1Click(TObject *Sender)
{


int m;
for ( m = 0; m < FileListBox1->Items->Count; m )
{
}


for (int x=0;x<11;x ) //清除StringGrid2的內容
for (int y=0;y<200;y )
{
StringGrid1->Cells[x][y] ="";
StringGrid2->Cells[x][y] ="";
StringGrid3->Cells[x][y] ="";
}


for(int k=0;k{
String path;
int i;
FileListBox1->ItemIndex =k;
path=FileListBox1->FileName;
Panel1->Visible=false;

FILE *ptr;
char buf[100];
sprintf(buf,"%s",path.c_str()); //以String 宣告path的字容無結束字元,故丟到字串變數buf中
ptr=fopen(buf,"rt"); //以便讓ptr載入內容時有截止點
fgets(Buf,200,ptr);//1
FileName = strtok(Buf,seps);
i=k 1;
while(FileName !=NULL)
{
FileName=strtok(NULL,seps);
StringGrid1->Cells[0][i]=FileName;
i ;
}
fgets(Buf,200,ptr);//2
ModelNo=strtok(Buf,seps);
i=k 1;
while(ModelNo !=NULL)
{
ModelNo=strtok(NULL,seps);
StringGrid1->Cells[1][i]=ModelNo;
i ;
}
fgets(Buf,200,ptr);//3
fgets(Buf,200,ptr);//4
fgets(Buf,200,ptr);//5
fgets(Buf,200,ptr);//6
EquipmentNo=strtok(Buf,seps);
i=k 1;
while(EquipmentNo !=NULL)
{
EquipmentNo=strtok(NULL,seps);
StringGrid1->Cells[2][i]=EquipmentNo;
i ;
}
fgets(Buf,200,ptr);//7
fgets(Buf,200,ptr);//8
BinGrade=strtok(Buf,seps);
i=k 1;
while(BinGrade !=NULL)
{
BinGrade=strtok(NULL,seps);
StringGrid1->Cells[3][i]=BinGrade;
i ;
}
fgets(Buf,200,ptr);//9
fgets(Buf,200,ptr);//10
fgets(Buf,200,ptr);//11
fgets(Buf,200,ptr);//12

WaferID1=strtok(Buf,seps);
int j=1;
j=(k*2) j;
StringGrid2->Cells[1][j]=WaferID1;
i=2;
while(WaferID1 !=NULL)
{
WaferID1=strtok(NULL,seps);
StringGrid2->Cells[i][j]=WaferID1;
i ;
}
fgets(Buf,200,ptr);//13
fgets(Buf,200,ptr);//14
Qty1=strtok(Buf,seps);
j=(k*2) 2;
i=2;
StringGrid2->Cells[1][j]=Qty1;
while(Qty1 !=NULL)
{
if (i>10)
{
j=(k*2) j 2;
i=1;
}
Qty1=strtok(NULL,seps);
StringGrid2->Cells[i][j]=Qty1;
i ;
}
fgets(Buf,200,ptr);//15
TChip=strtok(Buf,seps);
i=k 1;
while(TChip !=NULL)
{
TChip=strtok(NULL,seps);
StringGrid1->Cells[4][i]=TChip;
i ;
}
fgets(Buf,200,ptr);//16
fgets(Buf,200,ptr);//17
fgets(Buf,200,ptr);//18
fgets(Buf,200,ptr);//19
fgets(Buf,200,ptr);//20
Rvlw1=strtok(Buf,seps1);
j=k 1;
StringGrid3->Cells[0][j]=Rvlw1;
i=1;
while(Rvlw1 !=NULL)
{
Rvlw1=strtok(NULL,seps1);
StringGrid3->Cells[i][j]=Rvlw1;
i ;
}

}


}
//---------------------------------------------------------------------------

void __fastcall TForm1::Button13Click(TObject *Sender)
{
Panel1->Visible=true;
}
//---------------------------------------------------------------------------

系統時間:2024-04-29 11:25:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!