I have this function to modify a node, but when I use it, it modifies the node I asked for but deletes the others.
How can I change it and not delete the other nodes?
_nodoActividades *modificarActividades(_nodoActividades *apuntador)
{
char materia[20];
char tipo[20];
printf("\nQUE ACTIVIDAD DESEA MODIFICAR: ");
scanf("%s",materia);
fflush(stdin);
printf("\nINDICO EL TIPO DE ACTIVIDAD: ");
scanf("%s",tipo);
fflush(stdin);
if (!listaVaciaActividades(apuntador))
{
_nodoActividades *apuntadorAuxiliar;
apuntadorAuxiliar = apuntador;
while (apuntadorAuxiliar != NULL)
{
if (apuntadorAuxiliar != NULL && strcmp(apuntadorAuxiliar->nombre, materia) == 0)
//(!verificarNombre(apuntador, materia) && !verificarTipo(apuntador, tipo)) //&& strcmp(apuntadorAuxiliar->tipoDeActividad, materia) == 0))
{
if(!verificarTipo(apuntador, tipo))
{
char nombre[30];
char tipoDeActividad[30];
char diaDeLaSemana[20];
char horaDeIncio[10];
char horaDeFin[10];
char salon[10];
system("clear");
printf("\n----NUEVA ACTIVIDAD----\n");
printf("NOMBRE DE LA MATERIA: ");
fflush(stdin);
scanf("%s",nombre);
while(!validarLetras(nombre))
{
printf("\nPOR FAVOR SOLO ESCRIBA LETRAS ");
printf("\nNOMBRE: ");
fflush(stdin);
scanf("%s",nombre);
/*while(!buscarMateria())*/
}
printf("TIPO DE ACTIVIDAD: ");
fflush(stdin);
scanf("%s",tipoDeActividad);
while(!validarLetras(tipoDeActividad))
{
printf("\nPOR FAVOR SOLO ESCRIBA LETRAS ");
printf("\nTIPO DE ACTIVIDAD: ");
fflush(stdin);
scanf("%s",tipoDeActividad);
}
printf("DIA DE LA SEMANA: ");
fflush(stdin);
scanf("%s",diaDeLaSemana);
while(!validarLetras(diaDeLaSemana))
{
printf("\nPOR FAVOR SOLO ESCRIBA LETRAS");
printf("\nDIA DE LA SEMANA: ");
fflush(stdin);
scanf("%s",diaDeLaSemana);
}
printf("HORA DE INICIO: ");
fflush(stdin);
scanf("%s",horaDeIncio);
while(!validarNumero(horaDeIncio))
{
printf("\nPOR FAVOR SOLO ESCRIBA NUMEROS");
printf("\nHORA DE INICIO: ");
fflush(stdin);
scanf("%s",horaDeIncio);
}
fflush(stdin);
printf("HORA DE FIN: ");
fflush(stdin);
scanf("%s",horaDeFin);
while(!validarNumero(horaDeFin))
{
printf("\nPOR FAVOR SOLO ESCRIBA NUMEROS");
printf("\nHORA DE FIN: ");
fflush(stdin);
scanf("%s",horaDeFin);
}
fflush(stdin);
printf("SALON: ");
fflush(stdin);
scanf("%s",salon);
while(!validarNumero(salon))
{
printf("\nPOR FAVOR SOLO ESCRIBA NUMEROS");
printf("\nSALON: ");
fflush(stdin);
scanf("%s",salon);
}
fflush(stdin);
strcpy(apuntadorAuxiliar->nombre, nombre);
strcpy(apuntadorAuxiliar->tipoDeActividad, tipoDeActividad);
strcpy(apuntadorAuxiliar->diaDeLaSemana, diaDeLaSemana);
strcpy(apuntadorAuxiliar->horaDeIncio, horaDeIncio);
strcpy(apuntadorAuxiliar->horaDeFin, horaDeFin);
strcpy(apuntadorAuxiliar->salon, salon);
apuntadorAuxiliar->siguiente = NULL;
}
}
apuntadorAuxiliar = apuntadorAuxiliar->siguiente;
}
printf("\nSU MATERIA FUE MODIFICADA EXITOSAMENTE");
getchar();
}
else
{
printf("\nNO EXISTE ESA MATERIA CREADA");
getchar();
}
return apuntador;
}