Login Page - Create Account

Support Board


Date/Time: Fri, 19 Apr 2024 14:40:37 +0000



sc.GetPersistentSCString not returning the value set

View Count: 570

[2019-12-07 20:57:29]
joshtrader - Posts: 439
The following code would set the persistent string, and then return that, I would think:


SCSFExport scsf_TemplateFunction(SCStudyInterfaceRef sc)
{
  if (sc.SetDefaults)
  {
    sc.GraphName = "Template Function";
    sc.AutoLoop = 1;

    sc.SetPersistentSCString(1122, sc.Symbol);
    
    return;
  }
  
  SCString& mySymbol = sc.GetPersistentSCString(1122);

  SCString Buffer;
  Buffer.Format("My string is %s", mySymbol);

  sc.AddMessageToLog(Buffer, 0);
}


However, returned is:
My string is €®"

This would seem to be just printing an address, but I don't see my error above. Any ideas?
[2019-12-07 21:42:33]
Sierra Chart Engineering - Posts: 104368
There is a problem in your code. Here is the corrected relevant line:
Buffer.Format("My string is %s", mySymbol.GetChars());

Sierra Chart Support - Engineering Level

Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy:
https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation

For the most reliable, advanced, and zero cost futures order routing, *change* to the Teton service:
Sierra Chart Teton Futures Order Routing

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account