Link to home
Start Free TrialLog in
Avatar of calis
calis

asked on

What is the equivalent to the sizeoff(variable) in C

What is the equivalent to the
sizeoff(varname)in C and could I please have an example.
Avatar of mcrider
mcrider

I think what you're looking for is LEN()

There really is no sizeof in VB.


For example:

Dim X as String
Dim Y as Long
X="abcdefg"
Y=Len(X)
'Y will equal 7


Cheers!
Also, if you have the following:

Dim Z as Long
Z=32768

if you do: len(Z) you will always get 4 because it takes 4 bytes to store a long number...

if you do len(cstr(Z)) you will get 5, because there are 5 characters in "32768"


Cheers!
 5
 4
 4
?zz
 0
zz=32767
Avatar of calis

ASKER

I need to find the sizeof of a UDT to pass to my C API
ASKER CERTIFIED SOLUTION
Avatar of mcrider
mcrider

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
LenB will return size in bytes.
MsgBox LenB(yourUDT)