Login Page - Create Account

Support Board


Date/Time: Thu, 16 Jan 2025 21:47:56 +0000



v1644 SCString.Format() corruption

View Count: 907

[2017-11-20 11:52:56]
DabbaDo - Posts: 148
Edit: Ignore this. Started working okay when I rebooted then restarted VS2017. Ugh!

This was working for me in some earlier version.


SCString tmp = "Test";
tmp.Format("%s", tmp.GetChars()); // tmp is corrupted

SCString bad = "Prefix";
SCString good;
good.Format("%s %s", bad.GetChars(), "Suffix"); // this is okay "Prefix Suffix"
bad.Format("%s %s", bad.GetChars(), "Suffix"); // this gives [garbage] plus "Suffix"

Perhaps something changed in my environment? Or maybe this is new behavior?

Thanks,
Dale
Date Time Of Last Edit: 2017-11-20 12:01:00
[2017-11-20 13:15:13]
Sierra Chart Engineering - Posts: 104368
Your code is simply unsafe. You should recognize the mistake you are making. You are copying the content of a string and modifying the same string at the same time.
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