Tema: Acentos html
Ver Mensaje Individual
  #2 (permalink)  
Antiguo 02/12/2010, 00:27
fguespe
 
Fecha de Ingreso: noviembre-2010
Mensajes: 37
Antigüedad: 13 años, 6 meses
Puntos: 0
Respuesta: Acentos html

Lo resumo a esto



int main(void){
char c=' ';
FILE * pf;
FILE * pd;
pf=fopen("html.txt","r");
pd=fopen("html2.txt","w");

if(pd!=NULL && pf !=NULL){
while((c=fgetc(pf))!=EOF){
if(c=='á')fprintf(pd,"ã");
else if(c=='é')fprintf(pd,"&etilde;");
else if(c=='í')fprintf(pd,"ĩ");
else if(c=='ó')fprintf(pd,"õ");
else if(c=='ú')fprintf(pd,"ũ");
else if(c=='ñ')fprintf(pd,"ñ");
else fputc(c,pd);
}
fclose (pf);
fclose (pd);
//remove(leer_archivo);
}else{
puts("Error en archivo");
}
return 0;

}