Hello. I'm new here and I do not even know if I was very objective in the title. But let's go. I'm almost finishing my final C Algorithm project, and I'm not able to update an item from one table with information from another.
More specific:
It is a program for scheduling medical appointments. I have the table of patients, doctors and consultations. Patient and physician tables are running 100% (recording and changing). My problem is in the table of queries. Start or save queries module. The query.id is generated automatically automatic. To choose the patient query, I invoke the listBoxPacientes for the user to select one of the patients and his name is saved in the patient query. I pass the memory address to the output pointer, then it receives the new contents when I return to the module. write query, the query.
Follow the code:
typedef struct paciente{
int cod;
char nome[30];
char sexo[1];
char endereco[50];
} Paciente;
typedef struct consulta{
int id;
char situacao[2];
char medico[20];
char paciente[30];
char data[11];
char hora[6];
} Consulta;
void gravarConsulta(){
Consulta consulta;
...
listBoxPaciente(consulta.paciente, 3); // carrega listagem de pacientes
gotoxy(12,13); printf("%s", consulta.paciente); // entra com o nome do paciente
...
}
void listBoxPaciente(char *saida, int carregar){
Paciente novoPaciente[50];
...
if (carregar == 3) {
saida = novoPaciente[y].nome;
}
...
}
All I need to finish is to choose one of the patients from the table patients.txt and write to the table queries.txt. It is written the last query.name that you read at the time of searching the next query.id.
I hope someone can help.