• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetError函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetError函数的典型用法代码示例。如果您正苦于以下问题:C++ GetError函数的具体用法?C++ GetError怎么用?C++ GetError使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetError函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ZeroMemory

static char *execute(char *command, int wait) /* {{{1 */
{
	STARTUPINFO si;
	PROCESS_INFORMATION pi;
	ZeroMemory(&si, sizeof(si));
	ZeroMemory(&pi, sizeof(pi));
	si.cb = sizeof(si);
	if (CreateProcess(0, command, 0, 0, 0, CREATE_NO_WINDOW, 0, 0, &si, &pi)) {
		if (wait) {
			WaitForSingleObject(pi.hProcess, INFINITE);
			/* long exit_code; */
			/* TODO: GetExitCodeProcess( pi.hProcess, &exit_code); */
			CloseHandle(pi.hProcess);
			CloseHandle(pi.hThread);
		}
		return Success(NULL);
	} else {
		return Failure(GetError());
	}
}
开发者ID:adamkuipers,项目名称:.vim,代码行数:20,代码来源:shell.c


示例2: GetError

BOOL CGuiRecordSet::GetCollect(int nIndex,CString& strValue)
{
	_variant_t vt;
	_variant_t vtn;
	vtn.vt = VT_I2;
	try
	{	
		vtn.iVal = nIndex;
		vt = m_rs->Fields->GetItem(vtn)->Value;
		if (vt.vt==VT_BSTR)
		{
			strValue=vt.bstrVal;
			return TRUE;
		}else return FALSE;
	}catch(_com_error &e)
	{
		GetError(e);
		return FALSE;
	}
}
开发者ID:darwinbeing,项目名称:trade,代码行数:20,代码来源:GuiADODB.cpp


示例3: sizeof

float CCoreAudioUnit::GetLatency()
{
  if (!m_audioUnit)
    return 0.0f;

  Float64 latency;
  UInt32 size = sizeof(latency);

  OSStatus ret = AudioUnitGetProperty(m_audioUnit,
    kAudioUnitProperty_Latency, kAudioUnitScope_Global, 0, &latency, &size);

  if (ret)
  {
    CLog::Log(LOGERROR, "CCoreAudioUnit::GetLatency: "
      "Unable to set AudioUnit latency. Error = %s", GetError(ret).c_str());
    return 0.0f;
  }

  return latency;
}
开发者ID:misa17,项目名称:xbmc,代码行数:20,代码来源:CoreAudioUnit.cpp


示例4: main

/**
 * Updates the status (active/inactive) of an iam user's access key, based on
 * command line input
 */
int main(int argc, char** argv)
{
    if(argc != 4) {
        PrintUsage();
        return 1;
    }

    Aws::String user_name(argv[1]);
    Aws::String accessKeyId(argv[2]);

    auto status =
        Aws::IAM::Model::StatusTypeMapper::GetStatusTypeForName(argv[3]);

    if (status == Aws::IAM::Model::StatusType::NOT_SET) {
        PrintUsage();
        return 1;
    }

    Aws::SDKOptions options;
    Aws::InitAPI(options);

    {
        Aws::IAM::IAMClient iam;
        Aws::IAM::Model::UpdateAccessKeyRequest request;
        request.SetUserName(user_name);
        request.SetAccessKeyId(accessKeyId);
        request.SetStatus(status);

        auto outcome = iam.UpdateAccessKey(request);
        if (outcome.IsSuccess()) {
            std::cout << "Successfully updated status of access key " <<
                accessKeyId << " for user " << user_name << std::endl;
        } else {
            std::cout << "Error updated status of access key " << accessKeyId <<
                " for user " << user_name << ": " <<
                outcome.GetError().GetMessage() << std::endl;
        }
    }
    Aws::ShutdownAPI(options);
    return 0;
}
开发者ID:ronhash10,项目名称:aws-doc-sdk-examples,代码行数:45,代码来源:update_access_key.cpp


示例5: while

bool CParseBase::BasicParseLoop(CCodeElementList *pCodeList)
{
	CObjectClass *pOC;
	
	while((pOC = GetNextObjectClass(m_iCurLine)) != 0)
	{
		if (!pOC->Parse(*this, *pCodeList))
			return false;
	}

	if (m_iCurPos >= (int) m_msText[m_iCurLine].csText.Len())
	{
		SetError(CPB_EOL);	// End of Line
		return false;
	}
	
	if (GetError() != CPB_NOERROR)
		return false;

	return true;
}
开发者ID:foobarz,项目名称:CLUCalcLinux,代码行数:21,代码来源:ParseBase.cpp


示例6: sizeof

Float64 CCoreAudioDevice::GetNominalSampleRate()
{
  if (!m_DeviceId)
    return 0.0f;

  AudioObjectPropertyAddress  propertyAddress;
  propertyAddress.mScope    = kAudioDevicePropertyScopeOutput;
  propertyAddress.mElement  = 0;
  propertyAddress.mSelector = kAudioDevicePropertyNominalSampleRate;

  Float64 sampleRate = 0.0f;
  UInt32  propertySize = sizeof(Float64);
  OSStatus ret = AudioObjectGetPropertyData(m_DeviceId, &propertyAddress, 0, NULL, &propertySize, &sampleRate);
  if (ret != noErr)
  {
    CLog::Log(LOGERROR, "CCoreAudioDevice::GetNominalSampleRate: "
      "Unable to retrieve current device sample rate. Error = %s", GetError(ret).c_str());
    return 0.0f;
  }
  return sampleRate;
}
开发者ID:0xheart0,项目名称:xbmc,代码行数:21,代码来源:CoreAudioDevice.cpp


示例7: if

BOOL CGuiRecordSet::GetCollect(LPCTSTR lpField,int& nValue)
{
	_variant_t vt;
	try
	{
		vt = m_rs->Fields->GetItem(lpField)->Value;
		if (vt.vt==VT_I2)
		{
			nValue=vt.intVal;
			return TRUE;
		}else if (vt.vt==VT_BOOL)
		{
			nValue=vt.boolVal;
			return TRUE;
		}else return FALSE;
	}catch(_com_error &e)
	{
		GetError(e);
		return FALSE;
	}
}
开发者ID:darwinbeing,项目名称:trade,代码行数:21,代码来源:GuiADODB.cpp


示例8: AudioUnitSetProperty

bool CAUOutputDevice::SetCurrentDevice(AudioDeviceID deviceId)
{
  if (!m_audioUnit)
    return false;

  OSStatus ret = AudioUnitSetProperty(m_audioUnit, kAudioOutputUnitProperty_CurrentDevice,
    kAudioUnitScope_Global, kOutputBus, &deviceId, sizeof(AudioDeviceID));
  if (ret)
  {
    CLog::Log(LOGERROR, "CCoreAudioUnit::SetCurrentDevice: "
      "Unable to set current device. Error = %s", GetError(ret).c_str());
    return false;
  }

  m_DeviceId = deviceId;

  CLog::Log(LOGDEBUG, "CCoreAudioUnit::SetCurrentDevice: "
    "Current device 0x%08x", (uint)m_DeviceId);

  return true;
}
开发者ID:JohnsonAugustine,项目名称:xbmc-rbp,代码行数:21,代码来源:CoreAudioUnit.cpp


示例9: sizeof

bool CAUOutputDevice::SetChannelMap(CoreAudioChannelList* pChannelMap)
{
  // The number of array elements must match the
  // number of output channels provided by the device
  if (!m_audioUnit || !pChannelMap)
    return false;

  UInt32 channels = pChannelMap->size();
  UInt32 size = sizeof(SInt32) * channels;
  SInt32* pMap = new SInt32[channels];
  for (UInt32 i = 0; i < channels; i++)
    pMap[i] = (*pChannelMap)[i];

  OSStatus ret = AudioUnitSetProperty(m_audioUnit,
    kAudioOutputUnitProperty_ChannelMap, kAudioUnitScope_Input, 0, pMap, size);
  if (ret)
    CLog::Log(LOGERROR, "CCoreAudioUnit::GetBufferFrameSize: "
      "Unable to get current device's buffer size. Error = %s", GetError(ret).c_str());
  delete[] pMap;
  return (!ret);
}
开发者ID:JohnsonAugustine,项目名称:xbmc-rbp,代码行数:21,代码来源:CoreAudioUnit.cpp


示例10: QObject

UbuntuUnityHack::UbuntuUnityHack(QObject* parent)
  : QObject(parent)
{
  // Check if we're on Ubuntu first.
  QFile lsb_release("/etc/lsb-release");
  if (lsb_release.open(QIODevice::ReadOnly)) {
    QByteArray data = lsb_release.readAll();
    if (!data.contains("DISTRIB_ID=Ubuntu")) {
      // It's not Ubuntu - don't do anything.
      return;
    }
  }

  // Get the systray whitelist from gsettings.  If this fails we're probably
  // not running on a system with unity
  QProcess* get = new QProcess(this);
  connect(get, SIGNAL(finished(int)), SLOT(GetFinished(int)));
  connect(get, SIGNAL(error(QProcess::ProcessError)), SLOT(GetError()));
  get->start(kGSettingsFileName, QStringList()
             << "get" << kUnityPanel << kUnitySystrayWhitelist);
}
开发者ID:BrummbQ,项目名称:Clementine,代码行数:21,代码来源:ubuntuunityhack.cpp


示例11: AudioDeviceCreateIOProcID

bool CCoreAudioDevice::AddIOProc()
{
  // Allow only one IOProc at a time
  if (!m_DeviceId || m_IoProc)
    return false;

  OSStatus ret = AudioDeviceCreateIOProcID(m_DeviceId, DirectRenderCallback, this, &m_IoProc);
  if (ret)
  {
    CLog::Log(LOGERROR, "CCoreAudioDevice::AddIOProc: "
      "Unable to add IOProc. Error = %s", GetError(ret).c_str());
    m_IoProc = NULL;
    return false;
  }

  Start();

  CLog::Log(LOGDEBUG, "CCoreAudioDevice::AddIOProc: "
    "IOProc %p set for device 0x%04x", m_IoProc, (uint)m_DeviceId);
  return true;
}
开发者ID:manio,项目名称:xbmc,代码行数:21,代码来源:CoreAudioDevice.cpp


示例12: CreateMainWindow

HWND
CreateMainWindow(LPCTSTR lpCaption,
                 int nCmdShow)
{
    PMAIN_WND_INFO Info;
    HWND hMainWnd = NULL;

    Info = (MAIN_WND_INFO*) HeapAlloc(ProcessHeap,
                     HEAP_ZERO_MEMORY,
                     sizeof(MAIN_WND_INFO));

    if (Info != NULL)
    {
        Info->nCmdShow = nCmdShow;

        hMainWnd = CreateWindowEx(WS_EX_WINDOWEDGE,
                                  szMainWndClass,
                                  lpCaption,
                                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  680,
                                  450,
                                  NULL,
                                  NULL,
                                  hInstance,
                                  Info);
        if (hMainWnd == NULL)
        {
            //int ret;
            //ret = GetLastError();
            GetError();
            HeapFree(ProcessHeap,
                     0,
                     Info);
        }
    }

    return hMainWnd;
}
开发者ID:RPG-7,项目名称:reactos,代码行数:40,代码来源:mainwnd.c


示例13: CreateMainWindow

HWND
CreateMainWindow(LPCTSTR lpCaption,
                 int nCmdShow)
{
    PMAIN_WND_INFO Info;
    HWND hMainWnd = NULL;

    Info = (PMAIN_WND_INFO)HeapAlloc(ProcessHeap,
                                     HEAP_ZERO_MEMORY,
                                     sizeof(MAIN_WND_INFO));

    if (Info != NULL)
    {
        Info->nCmdShow = nCmdShow;
        Info->Display = DevicesByType;
        Info->bShowHidden = TRUE;

        hMainWnd = CreateWindowEx(WS_EX_WINDOWEDGE,
                                  szMainWndClass,
                                  lpCaption,
                                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS,
                                  CW_USEDEFAULT,
                                  CW_USEDEFAULT,
                                  600,
                                  450,
                                  NULL,
                                  NULL,
                                  hInstance,
                                  Info);
        if (hMainWnd == NULL)
        {
            GetError();
            HeapFree(ProcessHeap,
                     0,
                     Info);
        }
    }

    return hMainWnd;
}
开发者ID:RareHare,项目名称:reactos,代码行数:40,代码来源:mainwnd.c


示例14: main

/**
 * Creates a cloud watch logs subscription filter, based on command line input
 */
int main(int argc, char** argv)
{
    if (argc != 5)
    {
        std::cout << "Usage: " << std::endl << "  put_subscription_filter "
            << "<filter_name> <filter_pattern> <log_group_name> " <<
            "<lambda_function_arn>" << std::endl;
        return 1;
    }

    Aws::SDKOptions options;
    Aws::InitAPI(options);
    {
        Aws::String filter_name(argv[1]);
        Aws::String filter_pattern(argv[2]);
        Aws::String log_group(argv[3]);
        Aws::String dest_arn(argv[4]);

        Aws::CloudWatchLogs::CloudWatchLogsClient cwl;
        Aws::CloudWatchLogs::Model::PutSubscriptionFilterRequest request;
        request.SetFilterName(filter_name);
        request.SetFilterPattern(filter_pattern);
        request.SetLogGroupName(log_group);
        request.SetDestinationArn(dest_arn);
        auto outcome = cwl.PutSubscriptionFilter(request);
        if (!outcome.IsSuccess())
        {
            std::cout << "Failed to create cloudwatch logs subscription filter "
                << filter_name << ": " << outcome.GetError().GetMessage() <<
                std::endl;
        }
        else
        {
            std::cout << "Successfully created cloudwatch logs subscription " <<
                "filter " << filter_name << std::endl;
        }
    }
    Aws::ShutdownAPI(options);
    return 0;
}
开发者ID:gabordc,项目名称:aws-doc-sdk-examples,代码行数:43,代码来源:put_subscription_filter.cpp


示例15: Stop

bool CCoreAudioDevice::RemoveIOProc()
{
  if (!m_DeviceId || !m_IoProc)
    return false;

  Stop();

  OSStatus ret = AudioDeviceDestroyIOProcID(m_DeviceId, m_IoProc);
  if (ret)
    CLog::Log(LOGERROR, "CCoreAudioDevice::RemoveIOProc: "
      "Unable to remove IOProc. Error = %s", GetError(ret).c_str());
  else
    CLog::Log(LOGDEBUG, "CCoreAudioDevice::RemoveIOProc: "
      "IOProc %p removed for device 0x%04x", m_IoProc, (uint)m_DeviceId);
  m_IoProc = NULL; // Clear the reference no matter what

  m_pSource = NULL;

  Sleep(100);

  return true;
}
开发者ID:manio,项目名称:xbmc,代码行数:22,代码来源:CoreAudioDevice.cpp


示例16: msg

void ConnectThread::ThreadFunc()
{
	m_socket = m_address.m_socketFactory->CreateSocket();
	m_socket->Bind(m_address.m_localIP, m_address.m_localPort);

	if(m_socket->Connect(m_address.m_ip, m_address.m_port))
	{
		Connector* connector = m_address.m_connectorFactory->CreateConnector(m_socket);
		connector->SetId(m_address.m_id);
		connector->SetRemoteAddr(m_address.m_ip, m_address.m_port);
		m_socket = 0;
		ConnectorMessage msg(connector);
		onSignal(msg);
	}
	else
	{
		ConnectErrorMessage errMsg(m_address.m_moduleName, "", GetError());
		onSignal(errMsg);
		delete m_socket;
		m_socket = 0;
	}
}
开发者ID:volok-aleksej,项目名称:twainet,代码行数:22,代码来源:connect_thread.cpp


示例17: main

int main()
{
    int n, TC;
    printf("Input dimension (n): ");
    scanf("%d", &n);
    if (n <= 0) return -1;
    printf("Input number of the threads: ");
    scanf("%d", &TC);
    if (n <= 0) return -2;
    double * a = new double[n*n];
    double * b = new double[n];
    double * x = new double[n];
    int * index = new int[n];
    double * ac = new double[n*n];
    double * bc = new double[n*n];
    FillMatrix(a, b, n);
    for (int i = 0; i < n*n; i++) ac[i] = a[i]; // copy of A
    for (int i = 0; i < n; i++) bc[i] = b[i]; // copy of B

    PrintMatrix(a, b, n);

    timeval tv1;
    gettimeofday(&tv1, 0);
    if (!SolveSystem(n, a, b, x, index, TC))
    {
	printf("Bad matrix!\n");
	return -3;
    }
    timeval tv2;
    gettimeofday(&tv2,0);
    double Time = double(tv2.tv_sec)*1000000.0+double(tv2.tv_usec)-double(tv1.tv_sec)*1000000.0+double(tv1.tv_usec);
	
    printf("Result:\n"); PrintSolution(x, n);
    printf("\n\nThreads: %d,\nError: %1.17lf,\nTime=%1.4lf sec.\n", TC, GetError(ac, bc, x, n), Time/1000000.0);
    delete a; delete b;
    delete x; delete index;    
    delete ac;
    return 0;
}
开发者ID:tokar1,项目名称:mech-math,代码行数:39,代码来源:main.cpp


示例18: GetIPAddress

    // ========================================================================
    // Function:    GetIPAddress
    // Purpose:     To get the IP address of the string as an ipaddress
    //              structure. Throws an exception if the address cannot be
    //              converted.
    // ========================================================================
    ipaddress GetIPAddress( const std::string p_address )
    {
        
        if( IsIPAddress( p_address ) )
        {
            // if the address is just a regular IP address, there's no need
            // to do a DNS lookup, so just convert the string directly into
            // its binary format.
            ipaddress addr = inet_addr( p_address.c_str() );
            
            // if the address is invalid, throw a HOST_NOT_FOUND exception.
            if( addr == INADDR_NONE )
            {
                throw Exception( EDNSNotFound );
            }

            // by this point, the address is valid, so return it.
            return addr;
        }
        else
        {
            // the address isn't an IP address, so we need to look it up using
            // DNS. 
            struct hostent* host = gethostbyname( p_address.c_str() );

            // if there was an error, throw an exception.
            if( host == 0 )
            {
                // get the error from h_errno.
                throw Exception( GetError( false ) );
            }

            // now perform some really wierd casting tricks to get the value.
            // h_addr is a char*, so cast it into an ipaddress*, and 
            // dereference it to get the value.
            return *((ipaddress*)host->h_addr);
        }
    }
开发者ID:aadarshasubedi,项目名称:SimpleMUD,代码行数:44,代码来源:SocketLibSystem.cpp


示例19: main

/**
 * Creates a long-polled sqs queue based on command line input
 */
int main(int argc, char** argv)
{
    if (argc != 3)
    {
        std::cout << "Usage: long_polling_on_create_queue <queue_name> " <<
            "<poll_time_in_seconds>" << std::endl;
        return 1;
    }

    Aws::SDKOptions options;
    Aws::InitAPI(options);
    {
        Aws::String queue_name = argv[1];
        Aws::String poll_time = argv[2];

        Aws::SQS::SQSClient sqs;

        Aws::SQS::Model::CreateQueueRequest request;
        request.SetQueueName(queue_name);
        request.AddAttributes(
            Aws::SQS::Model::QueueAttributeName::ReceiveMessageWaitTimeSeconds,
            poll_time);

        auto outcome = sqs.CreateQueue(request);
        if (outcome.IsSuccess())
        {
            std::cout << "Successfully created queue " << queue_name <<
                std::endl;
        }
        else
        {
            std::cout << "Error creating queue " << queue_name << ": " <<
                outcome.GetError().GetMessage() << std::endl;
        }
    }
    Aws::ShutdownAPI(options);
    return 0;
}
开发者ID:gabordc,项目名称:aws-doc-sdk-examples,代码行数:41,代码来源:long_polling_on_create_queue.cpp


示例20: main

/**
 * Deletes an access key from an IAM user, based on command line input
 */
int main(int argc, char** argv)
{
    if (argc != 3)
    {
        std::cout << "Usage: delete_access_key <user_name> <access_key_id>"
            << std::endl;
        return 1;
    }

    Aws::SDKOptions options;
    Aws::InitAPI(options);
    {
        Aws::String user_name(argv[1]);
        Aws::String key_id(argv[2]);

        Aws::IAM::IAMClient iam;

        Aws::IAM::Model::DeleteAccessKeyRequest request;
        request.SetUserName(user_name);
        request.SetAccessKeyId(key_id);

        auto outcome = iam.DeleteAccessKey(request);

        if (!outcome.IsSuccess())
        {
            std::cout << "Error deleting access key " << key_id << " from user "
                << user_name << ": " << outcome.GetError().GetMessage() <<
                std::endl;
        }
        else
        {
            std::cout << "Successfully deleted access key " << key_id
                << " for IAM user " << user_name << std::endl;
        }
    }
    Aws::ShutdownAPI(options);
    return 0;
}
开发者ID:gabordc,项目名称:aws-doc-sdk-examples,代码行数:41,代码来源:delete_access_key.cpp



注:本文中的GetError函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetErrorStr函数代码示例发布时间:2022-05-30
下一篇:
C++ GetEnvironmentVariableW函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap