Oxygen Basic
Programming => Problems & Solutions => Topic started by: Frankolinox on July 03, 2013, 08:53:29 AM
-
how to convert cvl + mkl function into oxygen?
-
Hi Frank,
function cvl(string s, optional sys i) as long
if i then i-=1
long v at (i+strptr s)
return v
end function
function mkl(long v) as string
function=" "
long w at (strptr function)
w=v
end function
s=mkl 42
v=cvl s
print v
'Also useful:
sub PatchLong(string s, sys i, long v)
long w at (i-1+strptr s)
w=v
end sub
s=nuls 100
patchlong s,13,42
v=cvl s,13
print v
-
thanks charles :) that works fine.
another convertion problem here with "cast" function (freebasic)
sys i,b
byte b
i=&h0080
'b=cast(byte,i) ''freebasic
b=str(i)
print b '128
print i '128
'print b,i '128, -128 freebasic
do you have a good idea for "cast" function too? thanks in advance, frank
-
Hi Frank,
You don't need to cast between numbers in Oxygen, and our bytes are unsigned, so you go from 0..255.
sys i
byte b
i=&h0080
b=i
print b '128
print i '128
-
the problem is how to convert a "cast(a,b)" function to oxygen.
the result from freebasic was at the end 128, -128 with "b=cast(BYTE,i)", so the result for oxygen should be the same ;)
I wanted convert a freebasic example to oxygen and there's a need for it how to translate something like
...
cast(integer,x)
...
frank
-
In Oxygen:
single s=4.2
long v=cast long s
print hex(s) " " hex(v)
'result: 4 40866666
-
charles, thanks, that's looking good and gives the help I wanted :-)