hi there perl gurus.
I am creating a module in inline c. I want to concat a very large string fast. I
am getting weird crashes for each run. Also, it appears that my string is not
being concatinated at all.
I am using VC6.0, perl 5.8 on win32 xp.
how can I get this to work.
your help is appreciated. Thanks.
-Jer A.
---------------------------------------------------------------------
#!Perl
package DSTRING;
my $code = <<'END_C';
void concat( char *a, char *b, char *c) // got this function from a website
{
while( *a ) { /* while( *c++ = *a++ ); */
*c = *a; ++a; ++c;
}
while( *b ) {
*c = *b; ++b; ++c;
}
*c = '\0';
}
char* addString(char* DATA,char* dataToAdd) {
concat(DATA, strdup(dataToAdd),DATA);
return DATA;
}
END_C
use Inline;
Inline->bind(C => $code);
1;
my $data = "";
my $count = 0;
for(1...100000)
{
print $count,"\n";
$data = DSTRING::addString($data,"testdata");
$count++;
}
print $data;
print "END\n";
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs