Ver Mensaje Individual
  #1  
Antiguo 11-11-2009
fedee fedee is offline
Miembro
 
Registrado: feb 2009
Posts: 14
Reputación: 0
fedee Va por buen camino
Problema con funcion VOID

Es un poco rústica la función, pero me sale un problema.. que es el siguiente..

"Access violation at address 00401f59 in module 'SEPAF.exe'. Read of address 72745313"

Lo que hace la funcion es ver si ese día tal persona cumple años y si es asi la agrega a un ComboBox... El codigo es el siguiente..



void cumpleaños_h() {

Form1->ComboBox3->Clear();
TDateTime dia;
AnsiString aux = dia.CurrentDate();
aux = aux.SubString(0,5);
AnsiString año = dia.CurrentDate();
año = año.SubString(7,9);
paciente p;
fstream archi("C:/Pacientes.dat", ios::in | ios::binary | ios::app);
archi.seekg(0, ios::beg);

archi.read((char*)&p,sizeof(p));
while(!archi.eof())
{
AnsiString aux1 = p.fecha_nac;
AnsiString año1 = p.fecha_nac;
aux1 = aux1.SubString(0,5);

if(aux1 == aux){
AnsiString d;
char z[40];
char x[3];
AnsiString r = ", ";
char y[45];
AnsiString q = " (";
AnsiString t = ")";

strcpy(z,p.apellido);
strcpy(y,p.nombre);
strcpy(x,r.c_str());

strcat(z,x);
strcat (z,y);

año1 = año1.SubString(7,9);
int años = StrToInt(año) - StrToInt(año1);
AnsiString total = z+q+años+t;


Form1->ComboBox3->Items->Add(total);

}
archi.read((char*)&p,sizeof(p));
}


¿Puede ser que sea problema de los "ios::" en el fstream?

Desde ya muchas gracias!
Responder Con Cita