in reply to Re: C vs perl
in thread C vs perl
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
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: C vs perl
by broquaint (Abbot) on Apr 28, 2002 at 15:08 UTC |