Exemplo n.º 1
0
static FILE *LocalOpenLogFile(UnicodeString LogFileName, TDateTime Started, TSessionData *SessionData, bool Append, UnicodeString &ANewFileName)
{
  UnicodeString NewFileName = StripPathQuotes(GetExpandedLogFileName(LogFileName, Started, SessionData));
  FILE *Result = _wfsopen(ApiPath(NewFileName).c_str(),
      Append ? L"ab" : L"wb", SH_DENYWR);
  if (Result != nullptr)
  {
    setvbuf(Result, nullptr, _IONBF, BUFSIZ);
    ANewFileName = NewFileName;
  }
  else
  {
    throw ECRTExtException(FMTLOAD(LOG_OPENERROR, NewFileName));
  }
  return Result;
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
//---------------------------------------------------------------------------
FILE * OpenFile(const UnicodeString & LogFileName, TSessionData * SessionData, bool Append, UnicodeString & NewFileName)
{
  FILE * Result;
  UnicodeString ANewFileName = StripPathQuotes(GetExpandedLogFileName(LogFileName, SessionData));
  // Result = _wfopen(ANewFileName.c_str(), (Append ? L"a" : L"w"));
  Result = _fsopen(W2MB(ANewFileName.c_str()).c_str(),
    Append ? "a" : "w", SH_DENYWR); // _SH_DENYNO); // 
  if (Result != nullptr)
  {
    setvbuf(Result, nullptr, _IONBF, BUFSIZ);
    NewFileName = ANewFileName;
  }
  else
  {
    throw Exception(FMTLOAD(LOG_OPENERROR, ANewFileName.c_str()));
  }
  return Result;
}
Exemplo n.º 3
0
//---------------------------------------------------------------------
UnicodeString TConfiguration::GetRandomSeedFileName() const
{
  return StripPathQuotes(ExpandEnvironmentVariables(FRandomSeedFile)).Trim();
}