I have the following code. I have a method called SendBookDiffs(MTBookDiff *bookdiffs, UINT bookdiffs_total) which I would like to use. The description for this method is "This method accepts array of MTBookDiff structures, counting 'bookdiffs_total' elements."
So what I have tried is the following:
MTBookDiff *bookdiffs;
MTBookItem items[128];
bookdiffs->items = items;
But I encountered a "error C2106: '=' : left operand must be l-value" error. According to some replies, I have tried
memcpy(bookdiffs->items, items, sizeof(bookdiffs->items));
But is there the proper way of executing it? Thanks! Edited: Simplifying the question asked.
Based on the
#define MAX_PATH 260
enum EnMTAPIConstants
{
MT_SYMBOL_LEN =32,
MT_BOOK_DEPTH =32,
MT_ADDRESS_LEN =64,
MT_NEWSUBJECT_LEN =256,
MT_NEWSCATEGORY_LEN =256,
MT_LOGIN_LEN =64,
MT_PASSWORD_LEN =64,
MT_PARAMS_LEN =256,
MT_DESCRIPTION_LEN =MAX_PATH
}
struct MTBookItem
{
enum EnBookItemType
{
ItemReset=0,
ItemSell =1,
ItemBuy =2
};
UINT type;
double price;
INT64 volume;
UINT reserved[8];
};
struct MTBookDiff
{
wchar_t symbol[MT_SYMBOL_LEN];
MTBookItem items[MT_BOOK_DEPTH*4];
UINT items_total;
UINT reserved[64];
};
MTBookDiff *bookdiffs;
MTBookItem items[128];
bookdiffs->items = items;