I have a binary data file in format as below:
I know I can read this file by code as below:
My question is how can I copy data into stockData, so that I can use code as below to access them?
Code:
struct {
int32 day; // days since 1900-01-01
int32 open;
int32 high;
int32 low;
int32 close;
double64 volume;
} StockData;
I know I can read this file by code as below:
Code:
StockData stockData;
NSArray StockList* = [[NSArray alloc] initWithObjects:stockData];
NSData *data = [NSData dataWithContentsOfFile:myFile];
// How to copy data to stockData of stockList
My question is how can I copy data into stockData, so that I can use code as below to access them?
Code:
int day = [StockList objectAtIndex:0].day;
int open = [StockList objectAtIndex:0].open;
int high = [StockList objectAtIndex:0].high;
int low = [StockList objectAtIndex:0].low;
int close = [stockData objectAtIndex:0].close;
float volume = [StockList objectAtIndex:0].volume;