Login Page - Create Account

Support Board


Date/Time: Fri, 29 Mar 2024 07:19:35 +0000



Post From: ACSIL -> Open and write into a text file....

[2020-07-17 09:52:55]
gfx2trade - Posts: 48
ended up with ...

void iMessageToFile(SCStudyInterfaceRef sc, SCString myText) {

  SCDateTimeMS DateTimeMS , DateTimeMSRefChart;   
  
  unsigned int BytesWritten = 0;
  int FileHandle;
  int myTextLength = 0;
  
  SCString DateTimeString = sc.DateTimeToString(sc.CurrentSystemDateTime,FLAG_DT_COMPLETE_DATETIME_MS);
  
  myText = DateTimeString + "|" + myText;
  myText = sc.Symbol + "|" + myText;
  myTextLength = myText.GetLength() + 2; // +2 to count for \\
  // Directory must exists
  SCString outputfile = "C:\\Trading\\Plateforme\\Log\\Sierra\\TextLogFile.txt";
  sc.OpenFile(outputfile, n_ACSIL::FILE_MODE_OPEN_TO_APPEND, FileHandle);
  myText = myText + "\r\n";
  sc.WriteFile(FileHandle, myText, myTextLength, &BytesWritten);
  sc.CloseFile(FileHandle);
  
}