Eu fiz uma função em C que substitui os acentos que determinada palavra passada pelo parâmetro tem. O código funciona e substitui os caracteres com acento, mas o programa em si é abortado quando executa. Quem puder me ajudar com melhorias ou sugestões eu agradeço. Segue o código:
void retiraAcentos(char str[]) {
char *pch;
pch = strstr(str,"Á");
if (pch != NULL)
strncpy(pch,"A",6);
pch = strstr(str,"À");
if (pch != NULL)
strncpy(pch,"A",6);
pch = strstr(str,"Â");
if (pch != NULL)
strncpy(pch,"A",6);
pch = strstr(str,"Ã");
if (pch != NULL)
strncpy(pch,"A",6);
pch = strstr(str,"Ä");
if (pch != NULL)
strncpy(pch,"A",6);
pch = strstr(str,"É");
if (pch != NULL)
strncpy(pch,"E",6);
pch = strstr(str,"È");
if (pch != NULL)
strncpy(pch,"E",6);
pch = strstr(str,"Ê");
if (pch != NULL)
strncpy(pch,"E",6);
pch = strstr(str,"Ë");
if (pch != NULL)
strncpy(pch,"E",6);
pch = strstr(str,"Í");
if (pch != NULL)
strncpy(pch,"I",6);
pch = strstr(str,"Ì");
if (pch != NULL)
strncpy(pch,"I",6);
pch = strstr(str,"Î");
if (pch != NULL)
strncpy(pch,"I",6);
pch = strstr(str,"Ï");
if (pch != NULL)
strncpy(pch,"I",6);
pch = strstr(str,"Ó");
if (pch != NULL)
strncpy(pch,"O",6);
pch = strstr(str,"Ò");
if (pch != NULL)
strncpy(pch,"O",6);
pch = strstr(str,"Ô");
if (pch != NULL)
strncpy(pch,"O",6);
pch = strstr(str,"Õ");
if (pch != NULL)
strncpy(pch,"O",6);
pch = strstr(str,"Ö");
if (pch != NULL)
strncpy(pch,"O",6);
pch = strstr(str,"Ú");
if (pch != NULL)
strncpy(pch,"U",6);
pch = strstr(str,"Ù");
if (pch != NULL)
strncpy(pch,"U",6);
pch = strstr(str,"Û");
if (pch != NULL)
strncpy(pch,"U",6);
pch = strstr(str,"Ü");
if (pch != NULL)
strncpy(pch,"U",6);
pch = strstr(str,"Ç");
if (pch != NULL)
strncpy(pch,"C",6);
}