Login Page - Create Account

Support Board


Date/Time: Mon, 23 Dec 2024 04:55:06 +0000



[User Discussion] - problem with sc.AddMessageToLog

View Count: 2301

[2016-12-09 01:29:10]
User210074 - Posts: 63

#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <ctime>
#include "sierrachart.h"
using namespace std;
SCDLLName("CalendarEc")
SCSFExport scsf_CalendarEc(SCStudyInterfaceRef sc) {
SCInputRef Date = sc.Input[0];
  if(sc.SetDefaults) {
    sc.GraphName="CalendarEc";
    sc.StudyDescription="Economic Calendar";
    sc.AutoLoop = 1;
    sc.FreeDLL = 1;
    SCString File;
    File.Format("C:\\SierraChart\\Data\\CalendarEc.txt",sc.Symbol.GetSubString(4,0).GetChars());
    Date.SetString(File);
    return;
   }//END default
ifstream File(Date.GetString());
if(File){
string DateEc;
while(getline(File,DateEc)){
sc.AddMessageToLog(DateEc,1);
     //cout << DateEc << endl;
}
}
else{}
}// End Function
Error

-- Starting build of Custom Studies Source files: CalendarEc.cpp. -- 02:20:42

C:\WINDOWS\system32\cmd.exe /C "C:\Dev_SierraChart\ACS_Source\VisualCCompile.Bat"


C:\Dev_SierraChart\ACS_Source>call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
CalendarEc.cpp
C:\Dev_SierraChart\ACS_Source\CalendarEc.cpp(26): error C2664: 'void s_sc::AddMessageToLog(const SCString &,int)': cannot convert argument 1 from 'std::string' to 'const char *'
C:\Dev_SierraChart\ACS_Source\CalendarEc.cpp(26): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
-- End of Build -- 02:20:45
I do not know how to fix the problem with the sc.AddMessageToLog function to display the date in MessageLog
[2016-12-09 01:42:14]
Sierra Chart Engineering - Posts: 104368
You need to do it like this:
sc.AddMessageToLog(DateEc.c_str(),1);

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