that issue is solved :-D
but i'm having a new problem :-(
i'm trying to copy variable data into a struct array, but i get errors in the process:
Unhandled exception at 0x6e79f689 (msvcr90d.dll) in gestao.exe: 0xC0000005: Access violation writing location 0x00000000.
Code:
typedef struct
{
int dia, mes, ano;
}Data;
typedef struct
{
char tipoConsulta[10];
Data dataConsulta;
int medico;
char especial[50];
char desc[100];
}Consulta;
typedef struct
{
int idPaciente;
int tempAprox;
char tipoConsultas[10];
}DadosConsultas;
typedef struct medico
{
char nome[50];
char morada[80];
int contacto;
char especialidade[50];
int numPacientes;
int idMedico;
int nConsultas;
Horario horarioTrab[5];
DadosConsultas *dados; //<------- data do save
}Medico;
typedef struct paciente
{
char nome[50];
char morada[80];
int contacto;
int numBenif;
int medicoFamilia;
int totalC;
Consulta *historico; //<-------- data to save
}Paciente;
the program crashes when i copy the variables data to the struct array:
Code:
if(tipo == 1)
tempP[j].historico[y].dataConsulta = dataHoje; //<------
else
{
tempP[j].historico[y].dataConsulta.dia = dia; //<------
tempP[j].historico[y].dataConsulta.mes = mes; //<------
tempP[j].historico[y].dataConsulta.ano = ano; //<------
}
strcpy(tempP[j].historico[y].tipoConsulta, tipoConsulta); //<------
tempP[j].historico[y].medico = idM; //<------
strcpy(tempP[j].historico[y].especial, especial); //<------
strcpy(tempP[j].historico[y].desc, desc); //<------
tempP[j].totalC = tempP[j].totalC + 1;
tempM[i].dados[x].idPaciente = nBenif; //<------
tempM[i].dados[x].tempAprox = tempo; //<------
strcpy(tempM[i].dados[x].tipoConsultas, tipoConsulta); //<------
Why is that?