Kyle R . Burton on Tue, 12 Jun 2001 14:34:06 -0400 |
Perhaps this is the wrong approach, but... I've got some C code that you pass a scalar to, which basicly ends up shortening the string you pass it. I'm assuming the fastet way to do this is to NULL out the next char and then somehow adjust Perl's perception of the length of the scalar. my $foo = 'abcdef'; trunc($foo); use Inline C => <<'EOC'; int foo(SV*sv) { char*p = SvPV(sv); int pos = 0; /* compute the location for pos */ p[pos] = '\0'; /* adjust the length of sv */ return pos; } EOC Without actualy using something like sv_setpv, sv_setpvn, or sv_setsv, can I just null out one of the chars, and then adjust the length that Perl has assoicated with the SV? I can't seem to find any macros or functions in perlguts or perlxs that shows how to adjust this length. Thanks, Kyle -- ------------------------------------------------------------------------------ Of course power tools and alcohol don't mix. Everyone knows power tools aren't soluble in alcohol... -- Crazy Nigel mortis@voicenet.com http://www.voicenet.com/~mortis ------------------------------------------------------------------------------ **Majordomo list services provided by PANIX <URL:http://www.panix.com>** **To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**
|
|