Login Page - Create Account

Support Board


Date/Time: Wed, 08 May 2024 03:09:29 +0000



Post From: How to declare variable to store data

[2018-10-22 16:05:47]
User517260 - Posts: 97
Dear Support, I need to store data in variable. Previously I declared variable before my study like shown below:
------------
#include "sierrachart.h"
SCDLLName("MyStudy")

int var1[100]

SCSFExport scsf_MyStudy(SCStudyGraphRef sc){}
------------

I used sc.ChartNumber as index of variable - var1[sc.ChartNumber] - and I didn't have problems - every instance of study used own global variable.
But after I used a few chartbooks - I've got a problem - var1[sc.ChartNumber] was shared same time for every chart with same number in every chartbook.
If chartbook may be indexed - I would use 2-dimentions variable like var1[sc.ChartNumber][sc.ChartbookNumber], but I didn't find variable in SC with number of current chartbook - only sc.ChartbookName - I can't use string variable for indexing.
What I have to do at this case? I need to store latest data in every instance of study without mutual sharing or collossions.
Waiting for your reply, Alex. Thanks!