Converting VB data to VC
I saved a VB type full of mostly bools and shorts to a file. I want to load it up in C++ code. How would I go about I converting these to unsigned ints and floats? I read through MSDN online and came up empty... Anyone have any code/help?
Thanks in advance,
Trajar
You should not have any problems converting VB''s integer to an unsigned int, although you''ll have to make sure you''re saving only positive values. (I can''t possibly see why you''d want to save a negative value and then load it as a positive one.)
What I don''t understand is how you plan to load a boolean. The VB boolean is a specialized 16-bit value designed to function only in Visual Basic. When you save it to file, it uses two bytes, and it has different meanings depending on how you load it. (In VB, True converts to -1 instead of 1.) I suggest you convert all booleans to bytes and then load them as chars in your C++ program.
If you need more info, let me know.
What I don''t understand is how you plan to load a boolean. The VB boolean is a specialized 16-bit value designed to function only in Visual Basic. When you save it to file, it uses two bytes, and it has different meanings depending on how you load it. (In VB, True converts to -1 instead of 1.) I suggest you convert all booleans to bytes and then load them as chars in your C++ program.
If you need more info, let me know.
GDNet+. It's only $5 a month. You know you want it.
An int in VC++ 6 is 32-bit while an Integer in VB 6 is only 16-bit. Thus, use a long instead of an integer since long and int in VC have the same size.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement