Page 1 of 1
StrPtr() in FNX
Posted: Sat Oct 12, 2013 9:23 am
by Gerhard P.
Hello,
can anyone tell me FNX`s equivalent of VB`s StrPtr(var) ?
Thank you
Gerhard
StrPtr() in FNX
Posted: Sat Oct 12, 2013 11:11 am
by cvirus
Those this will do?
VARPTR function
Returns the memory address.
Syntax: Varptr(variable name)
Returns the memory address used by windows for a specific variable.
Dim a as integer
Print Varptr(a)
The diference is that StrPtr(val) returns the adress of the first char in the string right?
StrPtr() in FNX
Posted: Sat Oct 12, 2013 11:48 am
by Gerhard P.
Yes. This seems to be correct.
So I think this could not be directly done ind FNX.
varptr requires a numeric variable, strptr a string.
Any suggestions how it can be done?
StrPtr() in FNX
Posted: Sat Oct 12, 2013 12:22 pm
by cvirus
Well in Fnx you also could do like this:
[code]dim a as String
dim b as integer
a="Hello varptr"
b=10
print("My Adress is "+str$(varptr(a)))
print("Written Words -> "+a)
print("My Adress is "+str$(varptr(b)))
print("Integer -> "+str$(b))
sleep(5000)[/code]
Works for both int and string
StrPtr() in FNX
Posted: Sat Oct 12, 2013 12:34 pm
by Gerhard P.
Thank you cvirus.
I`ll do it that way.
Gerhard
StrPtr() in FNX
Posted: Sat Oct 12, 2013 1:50 pm
by cvirus
Ok,
complete vars in varptr;
[code]
dim a as String
dim b as integer
dim c as double
dim d as boolean
a="Hello varptr"
b=10
c=5.2
d = 1
print("My Adress is "+str$(varptr(a)))
print("String -> "+a)
print()
print("My Adress is "+str$(varptr(b)))
print("Integer -> "+str$(b))
print()
print("My Adress is "+str$(varptr(c)))
print("Double -> "+str$(c))
print()
print("My Adress is "+str$(varptr(d)))
print("Boolean -> "+str$(d))
sleep(5000)
[/code]