Login Page - Create Account

Support Board


Date/Time: Sun, 29 Dec 2024 11:03:44 +0000



Post From: Read parameters from a file and set variables

[2016-01-19 19:01:57]
ertrader - Posts: 681
I have created a functioning example of how to read in parameters from a file. The .cpp and text file are attached. I have searched the support board and documentation and could not find a good example so I created one.

To get the code working:
1) Place the text file with parameters in the data folder or where your custom .dlls get compiled to
2) Compile the .cpp and attach to a graph as any other study

4 MA's will be drawn as an example.

My question is:
In regards to reading in values from a file and setting variables, is the method I have coded the correct and most efficient way for the SC environment?

In particular:
1) I am using global variables to pass multiple values (integers w,x,y,z read from the file and then the global variables are updated)
2) I am using iostream to read data that is space delimited. A close file command is not needed with iostream as best I can tell.

I'm not a c++ expert so am looking for suggestions.

Best regards
Date Time Of Last Edit: 2016-01-19 23:14:05
attachmenttextfile.txt - Attached On 2016-01-19 18:52:34 UTC - Size: 13 B - 333 views
attachmentReadFileExample.cpp - Attached On 2016-01-19 19:04:24 UTC - Size: 3.11 KB - 422 views