VB Types =? C Struct/Class
let''s say I have in VB:
Type SomeThing
myInt As Integer
End Type
and in C:
class SomeThing
{
public:
int myInt;
};
If I want to save these to a binary file, can I open the structure in C++ and well as Visual Basic interchangably?
If you''re smart about it you can. For example, write out the elements of the struct/class/Type out one at a time in the same way. Also restrict yourself to types common to both C++ and VB, especially don''t use Variant variable types in VB, unless you can guarantee the conversion into a C++ type.
THE VB TYPE declaration is language equal to the struct in c/c++, they are both data types, and can be trated like the standard int, char ....
c/c++/Java/Delphi/VB
November 19, 2000 08:46 AM
quote:
THE VB TYPE declaration is language equal to the struct in c/c++, they are both data types, and can be trated like the standard int, char ....
Yeah, but the question is if they are "binary equal" (i.e. represented the same way in memory).
I found that most of them are. The Integer in VB is only 2 bytes where as an int in C/C++ is four under windows. So if you even going to convert, check first.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement