Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAXCHARS 15
- typedef struct
- {
- char data[MAXCHARS];
- int prob[MAXCHARS];
- } LPRData;
- void GetData(LPRData *data);
- LPRData *Results;
- Results = (LPRData *)malloc(MAXRESULTS*sizeof(LPRData));
- GetData( Results );
- public struct LPRData
- {
- /// char[15]
- [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 15)]
- public string data;
- /// int[15]
- [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15)]
- public int[] prob;
- }
- GetData(LPRData[] data);
- [StructLayout(LayoutKind.Sequential, Size=TotalBytesInStruct),Serializable]
- public struct LPRData
- {
- /// char[15]
- [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 15)]
- public string data;
- /// int[15]
- [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15)]
- public int[] prob;
- }
- static extern void GetData([Out] out IntPtr ptr);
- LPRData[] GetData()
- {
- IntPtr value;
- LPRData[] array = new LPRData[3];
- GetData(out value);
- for (int i = 0; i < array.Length; i++)
- {
- array[i] = Marshal.PtrToStructure(value, typeof(LPRData));
- value += value.ToInt32() + Marshal.SizeOf(typeof(LPRData));
- }
- return array;
- }
Add Comment
Please, Sign In to add comment