Hi.
I'm trying to remove some characters within a string and substitute
others. For instance, I want to convert:
John's new house, great ---> Johns-new-house-great
I tried with:
----------------//------------------
int main()
{
char string2[50];
char *string = "John's new house, great";
int rc = sscanf(string, "%[, ]%s", string2);
if (rc = 2)
{
printf("%s\n", string2);
}
return 0;
}
-------------//---------------
But it doesn't work. Any suggestion? Thx.
I'm trying to remove some characters within a string and substitute
others. For instance, I want to convert:
John's new house, great ---> Johns-new-house-great
I tried with:
----------------//------------------
int main()
{
char string2[50];
char *string = "John's new house, great";
int rc = sscanf(string, "%[, ]%s", string2);
if (rc = 2)
{
printf("%s\n", string2);
}
return 0;
}
-------------//---------------
But it doesn't work. Any suggestion? Thx.
Comment