示例#1
0
文件: subacc.cpp 项目: bhaggerty/wwiv
bool open_sub(bool wr) {
  postrec p;

  close_sub();

  if (wr) {
    fileSub.SetName(subdat_fn);
    fileSub.Open(WFile::modeBinary | WFile::modeCreateFile | WFile::modeReadWrite, WFile::shareUnknown,
                 WFile::permReadWrite);

    if (fileSub.IsOpen()) {
      // re-read info from file, to be safe
      believe_cache = false;
      fileSub.Seek(0L, WFile::seekBegin);
      fileSub.Read(&p, sizeof(postrec));
      SetNumMessagesInCurrentMessageArea(p.owneruser);
    }
  } else {
    fileSub.SetName(subdat_fn);
    fileSub.Open(WFile::modeReadOnly | WFile::modeBinary);
  }

  return fileSub.IsOpen();
}
示例#2
0
void
WAssert(bool test, const char *message, int line, const char *file, const char *date)
{
	if (!test)
	{
		QString out = qApp->translate("Debug",
			"Send this message to [email protected]! "
			"This message has also been dumped to 'assert.txt'."
			"\n\n%1\n\nLine %2\nFile %3\nDate: %4").arg(qApp->translate("Debug",
				message)).arg(line).arg(file).arg(date);
		WFile f;
		if (f.Open(L"assert.txt", QIODevice::WriteOnly))
		{
			QByteArray tmp = out.toUtf8();
			f.WriteBlock(tmp, tmp.length());
			f.Close();
		}
		WPopup(out);
	}
}