Raz dziala, normalnie czyta z rekordu a raz wychodzi blad "Access volulation at adress 32C72111 in module CC32120MT.DLL.read of address 01EF8794" , przeszukalem google i nic. Prosze o pomoc
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include <fstream.h>
#include <string>
#include <vector>
#include "Unit3.h"
#include "Unit1.h"
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
class klienci
{
public:
int id;
string imie;
string nazwisko;
int wiek;
string pesel;
string ulica;
string miasto;
int nrdomu;
};
TForm2 *Form2;
klienci dana;
vector <klienci> odczyt;
int i;
//---------------------------------------------------------------------------
__fastcall TForm2::TForm2(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormClose(TObject *Sender, TCloseAction &Action)
{
Application->Terminate();
}
//---------------------------------------------------------------------------
void __fastcall TForm2::FormShow(TObject *Sender)
{
i=0;
ifstream infile("baza.bin", ios::binary);
if(infile)
{
while (!infile.eof())
{
infile.read((char*)&dana, sizeof(dana));
odczyt.push_back(dana);
};
infile.close();
};
Form2->Edit1->Text=odczyt[i].imie.c_str();
Form2->Edit2->Text=odczyt[i].nazwisko.c_str();
Form2->Edit3->Text=odczyt[i].wiek;
Form2->Edit5->Text=odczyt[i].miasto.c_str();
Form2->Edit6->Text=odczyt[i].ulica.c_str();
Form2->Edit7->Text=odczyt[i].nrdomu;
Form2->Edit8->Text=odczyt[i].id;
}
//---------------------------------------------------------------------------