Page 1 of 1
Convert number to octal
Posted: Sat Feb 19, 2005 8:32 am
by Garren
What is the easiest way to convert a number to octal in TextPipe Pro?
Thanks,
Garren
One more thing
Posted: Sat Feb 19, 2005 8:34 am
by Garren
One more thing...
I tried using the VBScript but this won't let me do large numbers. I can only do like 8 digits and I need to do 11 digit numbers.
Garren
Posted: Thu Feb 24, 2005 8:47 am
by DataMystic Support
Can you post the code you've used to achieve 8 digits?
Posted: Tue Mar 01, 2005 2:29 am
by garren
I used the VBscript function and had this in process line:
function processLine(line, EOL)
processLine = oct(line)
end function
oct is just a VB function, and in doing research it looks like it is limitation of the function that it can only handle 11 characters.
I tried to do this with the following perl script:
sub processLine {
$o = ($_[1]);
$n = oct($_[0]) if $_[0] =~ /^0/;
}
but when I try to run it I get the following error:
Missing function - processLine
Note - script language may be case sensitive.
I am not sure why I get this error because I have the above function.
Any help with the perlscript error or another way to do it would be appreciative.
Thanks,
Garren
Posted: Tue Mar 01, 2005 7:40 am
by DataMystic Support
Hi Garren,
perlscript doesn't work - we have an active bug request with ActiveState.
You're going to have to write a function that shifts the bits of the number progressively and builds the octal number.