//---------------------------------------------------------------------------
#include <vcl.h>
#include <windows.h>
#include <cstdlib>
#include <fstream.h>
#pragma hdrstop
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
int selected=0;
int code[12][12][10];
fstream f2;
fstream c;
//---------------------------------------------------------------------------
void __fastcall TForm1::Image22MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(Button==mbRight)
{
f2<<"0"<<endl; f2<<"0"<<endl;
Form2->Visible=true;
}
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
for(int i=0; i<=11; i++)
{
for(int o=0; o<=11; o++)
{
for(int p=0; p<=9; p++)
{
code[i][o][p]=0;
}
}
}
f2.open("config/f2.pnpconfig", ios::in | ios::out);
c.open("config/code.pnpconfig", ios::out | ios::in);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action)
{
f2.close();
c.close();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Image23MouseDown(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(Button==mbRight)
{
f2<<"0"<<endl<<"1"<<endl;
Form2->Visible=true;
}
}
Ostatnia funkcja w podanym fragmencie kodu powtarza się kilkanaście razy, tylko dla innych obiektów Image.
W powyższym kodzie coś powoduje, że gdy program kompiluje i odpalam, wyskakuje błąd Project Project1.exe raised exception class EAcceViolation with message 'Acces violation at adress 00502BA5. read of adress 00000000'. Process stopped. use Sted or run to continue. Przy wciśnięciu step problem się powtarza. Podobnie przy run. Gdy program włączam przez eksplorator windows, błąd się nie pokazuje, sęk w tym, że program też.