2
Hello. I’m new here and I’m not even sure I was objective in the title. But come on. I’m almost done with my final C Algorithms project, and I’m unable to update one item from one table with information from another.
More specific:
It is a program for scheduling medical appointments. I have a table of patients, doctors and appointments. Patient and doctor tables are working 100% (recording and alteration). My problem is in the table of appointments. Start the Save Queries module. The.id query is automatically generated. To choose the query.patient, I invoke the listBoxPatients for the user to select one of the patients and their name to be recorded in consultation.patient, pass the memory address to the outgoing pointer, then it receives the new content, When I return to the module of recording the consultations, the consultation.patient is not with the chosen name.
Follows 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.txt table and record queries in the table.txt. It is saved the last query.name you read when searching for the next query.id.
I hope someone can help.
The recording functionConsult is very extensive? You would mind posting it in full?
– user25930
How do I post. Here only lets use 500 characters.
– Lindomar Lemos
I posted on google drive:https://drive.google.com/file/0B7fBYLCTGkbdGJBcVlOMVVneTQ/view?usp=sharing
– Lindomar Lemos
You may not be able to post links because you are a new user. Anyway, I guess I don’t need to see the rest of the code anymore (see answer).
– user25930