Link to home
Start Free TrialLog in
Avatar of JJONES
JJONES

asked on

How to use VC structures and pointers in VB

Is there anyway in VB that you can define a String of Data (Buffer) and reference that data using a structure (Type) with a pointer?

VC Example:

struct EntryStruct
      {
      char szFldName [50];      
      int  nFldNumber;
      };


char szBuffer [500];
char szName   [100];      

EntryStruct* pPtr;
pPtr = (EntryStruct*) szBuffer;
szName = pPtr.szFldName;
Avatar of mackagp
mackagp

dunno if this helps, but you can define a fixed length string with
dim strxxx as string * 500

You can access any character in it by using

strxxy=mid(strxxx,position,1)


You can use RtlMoveMemory API to copy a struct into a buffer  directly, I think that will be the furthermost vb can do
Anyway, why are you asking, there might be a better way to achive what you want
ASKER CERTIFIED SOLUTION
Avatar of kuen
kuen

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