String or not, it's clear that if you were going to do that, you should have done this instead:/* ok, this could be done better but it's only a string ;-) */ ret = (char*) malloc(strlen(str) + strlen(str));
Also, your function does not work. (I think you forgot to test it before you posted.) You need to haveret = (char*) malloc(strlen(str) * 2);
in the if block.pret += 7;
--
Mark Dominus
Perl Paraphernalia
In reply to Re: C vs perl
by Dominus
in thread C vs perl
by mandog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |