Are you trying to pulish your C codes in any website or blogs ??
What do you do when you need to replace the entity symbol with entities ???
Do you just replace the entity symbols with the entity name for each occurence ??
You can make your work simple and easy with the C code...
Here I have posted a code that replaces the entity symbols with the entity names and outputs the HTML code with pre formatted type.
Just open the code in Ideone and enter your C code as input..
Voila...
Your HTML code was ready....
Here it shows the Run Time Error because of the infinite loop...
You can ignore it and copy the code from the STDOUT of ideone..
I have included only few entities and can be added if you wish...
Here is the list of Entities.
#include<stdio.h>
int main()
{
char a;
while(1)
{
scanf("%c",&a);
if(a=='<')
{
printf("<")
}
else if (a=='>')
{
printf(">")
}
else if(a=='&')
{
printf("&")
}
else
{
printf("%c",c);
}
}
return 0;
}

No comments:
Post a Comment