StrPtr() in FNX

In this category you can exchange your programming questions and solutions.
Post Reply
Gerhard P.
Posts: 10
Joined: Tue Sep 17, 2013 10:55 am

StrPtr() in FNX

Post: # 1125Post Gerhard P.
Sat Oct 12, 2013 9:23 am

Hello,

can anyone tell me FNX`s equivalent of VB`s StrPtr(var) ?

Thank you
Gerhard

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

StrPtr() in FNX

Post: # 1126Post cvirus
Sat Oct 12, 2013 11:11 am

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?

Gerhard P.
Posts: 10
Joined: Tue Sep 17, 2013 10:55 am

StrPtr() in FNX

Post: # 1127Post Gerhard P.
Sat Oct 12, 2013 11:48 am

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?

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

StrPtr() in FNX

Post: # 1128Post cvirus
Sat Oct 12, 2013 12:22 pm

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

Gerhard P.
Posts: 10
Joined: Tue Sep 17, 2013 10:55 am

StrPtr() in FNX

Post: # 1129Post Gerhard P.
Sat Oct 12, 2013 12:34 pm

Thank you cvirus.
I`ll do it that way.

Gerhard

cvirus
Posts: 88
Joined: Tue Jan 12, 2010 8:33 pm

StrPtr() in FNX

Post: # 1130Post cvirus
Sat Oct 12, 2013 1:50 pm

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]

Post Reply