how to replace spaces in a String with '%30'?
my code is,
int encode_string(char *st)
{
char *str = st;
while(*str!='\0')
{
if(*str==' ')
{
*str="%30";
}
str++;
}
printf("\n%s",st);
return 0;
}
it does not replacing the spaces with '%30' as it has more than 1 characters.
I am able to replace a single literal in a string but not with multiple chars.
how to do this?
please help
any help would be appriciated
thank you