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.
calisAsked:
Who is Participating?
 
mcriderConnect With a Mentor Commented:
Read the following microsoft articles:


HOWTO: Pass Array of UDTs with Variable Length Strings to C/C++
http://support.microsoft.com/support/kb/articles/Q194/6/09.ASP 

HOWTO: Pass Optional Parameters to a C DLL Function from VB
http://support.microsoft.com/support/kb/articles/Q153/5/46.asp 

HOWTO: Call C Functions That Use the _cdecl Calling Convention
http://support.microsoft.com/support/kb/articles/Q153/5/86.asp 


Cheers!
0
 
mcriderCommented:
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!
0
 
mcriderCommented:
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
0
 
calisAuthor Commented:
I need to find the sizeof of a UDT to pass to my C API
0
 
amebaCommented:
LenB will return size in bytes.
MsgBox LenB(yourUDT)
0
All Courses

From novice to tech pro — start learning today.