Sizeof in vb? 
Author Message
 Sizeof in vb?

Does VB have a function which is equivalent to sizeof() in C?

something where I can go sizeof(double) or sizeof(some user defined
structure)?

Thanks

RAnia



Sun, 17 Jan 1999 03:00:00 GMT  
 Sizeof in vb?

The Len() function, on strings, returns the string length.  On
numeric values, it returns the no of bytes required by the variable.  
On user-defined types, returns the total size of the type, in bytes.



Sun, 17 Jan 1999 03:00:00 GMT  
 Sizeof in vb?


Quote:
>Does VB have a function which is equivalent to sizeof() in C?

Len()


--
Sex isn't the answer. Sex is the question. Yes! is the answer



Sun, 17 Jan 1999 03:00:00 GMT  
 Sizeof in vb?

Quote:

> Does VB have a function which is equivalent to sizeof() in C?

Try using Len(varname).


Sun, 17 Jan 1999 03:00:00 GMT  
 Sizeof in vb?

Quote:

> Does VB have a function which is equivalent to sizeof() in C?

> something where I can go sizeof(double) or sizeof(some user defined
> structure)?

In VB32, there is a function that has been added called "LenB".
According to the help file:

"The Len function returns the size of a user-defined type as it will be
when written to a file.  By contrast, LenB returns the in-memory size of
a user-defined type, including any padding between elements."

So if you're using VB4 32bit, use LenB instead...

Geoff
====================================
      "I brake for MCSD's..."
------------------------------------
The Knowledge Base is YOUR FRIEND!!!
    http://www.microsoft.com/kb/
====================================



Mon, 18 Jan 1999 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. sizeof for VB objects?

2. Sizeof in VB

3. Sizeof in VB

4. Q: "Sizeof" in VB

5. VB and sizeof

6. 'sizeof' in VB

7. C "sizeof" in VB

8. Sizeof objects

9. VB6 SizeOf Method

10. SizeOf as in C

11. SizeOf Directory

12. sizeof

 

 
Powered by phpBB® Forum Software