VS2008 C言語でのアサートのメッセージ
アサートでメッセージを書きたいとき
どうやればいいのか悩んだのでメモ書き
こんな感じでロギングできるようになった。
System::String^ msg = getMesg("code =", code, " ファイル名=", filename); Assert::AreEqual((int)RTN_OK,(int)rtn, msg); ====================== System::String^ getHexStr2(int v) { System::String^ str = System::String::Format("0x{0,4:X}", v ); return str; } ======================= System::String^ getMesg(char *ch1, int value, char *ch2, char *data) { System::String^ ch1str = gcnew System::String(ch1); ch1str += getHexStr2(value); System::String^ ch2str = gcnew System::String(ch2); System::String^ datastr = gcnew System::String(data); ch1str += ch2str; ch1str += datastr; return ch1str; }