#include <iostream.h> #include <atlbase.h> #import <ccauto.dll> named_guids using namespace ClearCase; int main() { // ClearCase インターフェイスを取得します。 CComBSTR output; // COM ライブラリを初期化します。 CoInitialize(NULL); try { // 最上位の ClearTool オブジェクトを作成します。 IClearToolPtr pIClearTool = IClearToolPtr(CLSID_ClearTool); // ClearTool コマンドを発行します。 output.Append(pIClearTool->CmdExec(L"pwv")); // 結果を出力します。 USES_CONVERSION; if ( output.Length() >= 1 ) cout << (((BSTR)output != 0) ? OLE2A(output) : "<none>") << "¥n"; } // スローされる COM エラーをすべてキャッチします。 catch (_com_error& cerror) { cout << cerror.Description(); cout << cerror.Error() << "¥n"; } return 0; }