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

C++ ErrorPrint函数代码示例

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

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



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

示例1: MakeDirectory

void
MakeDirectory(char *OutputFileName)
{
#ifdef PLATFORM_WINDOWS
    if (!CreateDirectory(OutputFileName, 0))
    {
        if (GetLastError() != ERROR_ALREADY_EXISTS)
        {
            ErrorPrint("Create directory %s failed\n", OutputFileName);
        }
    }
#else
    if (mkdir(OutputFileName, 0755) < 0)
    {
        if (errno != EEXIST)
        {
            ErrorPrint("mkdir %s failed, errno = %d\n", OutputFileName, errno);
        }
        else
        {
            struct stat FileStatus;
            if (stat(OutputFileName, &FileStatus) < 0)
            {
                ErrorPrint("stat %s failed, errno = %d\n", OutputFileName, errno);
            }

            // TODO(wheatdog): Support symbolic link?
            if (!S_ISDIR(FileStatus.st_mode))
            {
                ErrorPrint("%s existed and it is not a folder.\n", OutputFileName);
            }
        }
    }
#endif
}
开发者ID:fierydrake,项目名称:HandmadeCompanion,代码行数:35,代码来源:handmade_srt_gen.cpp


示例2: while

bool NetReceiveOutputPin::addTransSocket(SOCKET sock)
{
	int tryCount = 20 * 100; //尝试20秒
	while (--tryCount > 0)
	{
		if (m_mt.majortype == GUID_NULL)
		{
			Sleep(10);
		}
		else
			break;
	}
	if (tryCount == 0)
	{
		return false;
	}

	if (!sendData(sock, (char*)&m_mt, sizeof(m_mt)))
	{
		ErrorPrint("Send media type error");
		return false;
	}

	if (!sendData(sock, (char*)m_mt.pbFormat, m_mt.cbFormat))
	{
		ErrorPrint("Send media format type error");
		return false;
	}
	CAutoLock lock(&m_TransSocketListCrit);
	m_TransSocketList.push_back(sock);
	return true;
}
开发者ID:dalinhuang,项目名称:networkprogram,代码行数:32,代码来源:NetReceiveFilter.cpp


示例3: ErrorPrint

bool Connection::acceptConnection(int connfd)
{
    if (mFd >= 0)
    {
        ErrorPrint("[acceptConnection] accept connetion error! the conn is in use!");
        return false;
    }

    mFd = connfd;

    // set nonblocking
    if (!core::setNonblocking(mFd))
    {
        ErrorPrint("[acceptConnection] set nonblocking error! %s", coreStrError());
        goto err_1;
    }

    tryRegReadEvent();

    mConnStatus = ConnStatus_Connected;
    return true;

err_1:
    close(mFd);
    mFd = -1;

    return false;
}
开发者ID:ruleless,项目名称:fasttun,代码行数:28,代码来源:connection.cpp


示例4: CalibrationDataWriteAndVerify

static int CalibrationDataWriteAndVerify(int address, unsigned char *buffer, int many)
{
    int it;
    unsigned char check;

	switch(ar9300_calibration_data_get(AH))
	{
		case calibration_data_flash:
#ifdef MDK_AP
			{
				int fd;
				// UserPrint("Do block write \n");
				// for(it=0;it<many;it++)
				//    printf("a = %x, data = %x \n",(address-it), buffer[it]);
				if((fd = open("/dev/caldata", O_RDWR)) < 0) {
					perror("Could not open flash\n");
					return 1 ;
				}

				for(it=0; it<many; it++) {
					lseek(fd, address-it, SEEK_SET);
					if (write(fd, &buffer[it], 1) < 1) {
						perror("\nwrite\n");
						return -1;
					}
				}
				close(fd);
				}
			return 0;
#endif
		case calibration_data_eeprom:
			for(it=0; it<many; it++)
			{
				Ar9300EepromWrite(address-it,&buffer[it],1);
				Ar9300EepromRead(address-it,&check,1);

				if(check!=buffer[it])
				{
					ErrorPrint(EepromVerify,address-it,buffer[it],check);
					return -1;
				}
			}
			break;
		case calibration_data_otp:
			for(it=0; it<many; it++)
			{
				Ar9300OtpWrite(address-it,&buffer[it],1,1);
				Ar9300OtpRead(address-it,&check,1,1);

				if(check!=buffer[it])
				{
					ErrorPrint(EepromVerify,address-it,buffer[it],check);
					return -1;
				}
			}
			break;
			return -1;
    }
    return 0;
}
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:60,代码来源:Ar9300EepromSave.c


示例5: closesocket

bool NetReceiveOutputPin::setSocket(SOCKET sock)
{
	//	CAutoLock lock(&m_SocketCrit);
	closesocket(m_Socket);
	m_Socket = sock;

	if (!receiveData(m_Socket, (char*)&m_mt, sizeof(m_mt)))
	{
		ErrorPrint("Receive media type error");
		return false;
	}
	m_mt.pbFormat = (PBYTE)CoTaskMemAlloc(m_mt.cbFormat);
	if (!receiveData(m_Socket, (char*)m_mt.pbFormat, m_mt.cbFormat))
	{
		ErrorPrint("Receive media format type error");
		return false;
	}

	if(m_mt.majortype == MEDIATYPE_Video && m_mt.formattype == FORMAT_VideoInfo)
	{
		VIDEOINFOHEADER* videoHeader = (VIDEOINFOHEADER*)m_mt.pbFormat;
		videoHeader->bmiHeader.biSizeImage = videoHeader->bmiHeader.biWidth * 
			videoHeader->bmiHeader.biHeight * videoHeader->bmiHeader.biBitCount / 8;
		m_mt.SetSampleSize(videoHeader->bmiHeader.biSizeImage);
		// 	tmp.pbFormat = (PBYTE)CoTaskMemAlloc(sizeof(VIDEOINFOHEADER));
		//	boost::scoped_array<char> formatBufferContainer((char*)tmp.pbFormat);
	}

	ReleaseSemaphore(m_SocketSema, 1, NULL); // 通知设置了新的socket

	return true;
}
开发者ID:dalinhuang,项目名称:networkprogram,代码行数:32,代码来源:NetReceiveFilter.cpp


示例6: Help

int Help(char *name, void (*print)(char *buffer))
{
	char buffer[MBUFFER];
	char start[MBUFFER];
	int count;
    int found;

	if(print!=0)
	{
		count=0;
        found=0;

		if(HelpFile==0)
		{
			HelpOpen("nart.help");
		}

		if(HelpFile!=0)
		{
			SformatOutput(start,MBUFFER-1,"<tag=%s>",name);
			buffer[MBUFFER-1]=0;

			HelpRewind();
			//
			// look for start of documentation section, <tag=name>
			//
			while(HelpRead(buffer,MBUFFER-1)>=0)
			{
				if(Smatch(buffer,start))
				{
                    found=1;
					break;
				}
			}
			//
			// print all lines up to the next <tag=anything>
			//
            if(found)
            {
                ErrorPrint(ParseHelpDescriptionStart);

			    while(HelpRead(buffer,MBUFFER-1)>=0)
			    {
				    if(strncmp(buffer,"<tag=",5)==0)
				    {
					    break;
				    }
				    ErrorPrint(ParseHelp,buffer);
				    count++;
			    }
				ErrorPrint(ParseHelpDescriptionEnd);
			    return count;
            }
		}
	}

	return -1;
}
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:58,代码来源:Help.c


示例7: shutdown

bool Connection::connect(const SA *sa, socklen_t salen)
{
    if (mFd >= 0)
        shutdown();

    if (mFd >= 0)
    {
        ErrorPrint("[connect] accept connetion error! the conn is in use!");
        return false;
    }

    mFd = socket(AF_INET, SOCK_STREAM, 0);
    if (mFd < 0)
    {
        ErrorPrint("[connect] create socket error! %s", coreStrError());
        return false;
    }

    // set nonblocking
    if (!core::setNonblocking(mFd))
    {
        ErrorPrint("[connect] set nonblocking error! %s", coreStrError());
        goto err_1;
    }

    if (::connect(mFd, sa, salen) == 0) // 连接成功
    {
        tryRegReadEvent();
        mConnStatus = ConnStatus_Connected;
        if (mHandler)
            mHandler->onConnected(this);
    }
    else
    {
        if (errno == EINPROGRESS)
        {
            mConnStatus = ConnStatus_Connecting;
            tryRegWriteEvent();
        }
        else
        {
            goto err_1;
        }
    }

    return true;

err_1:
    close(mFd);
    mFd = -1;

    return false;
}
开发者ID:ruleless,项目名称:fasttun,代码行数:53,代码来源:connection.cpp


示例8: main

int
main( int argc, char **argv )
{    
    LOG_FUNCTION_START();
    LogPrint( "S2Sim Started" );
    
    GetConnectionManager();
    GetMatlabManager();
    GetControlManager();
    GetSystemManager();
    
    auto iterationNumber = 0;
    
    GetControlManager().WaitUntilReady();
    while ( 1 )
    {
        try
        {
            GetSystemManager().AdvanceTimeStep();
        }
        catch ( ... )
        {
            ErrorPrint( "System Error, Exiting" );
            break;
        }
        
        ++iterationNumber;
        LogPrint( "Time: ", iterationNumber );
    }
    LOG_FUNCTION_END();
    return ( EXIT_SUCCESS );
}
开发者ID:asakyurek,项目名称:S2Sim,代码行数:32,代码来源:main.cpp


示例9: cnpkFlushSendData

int cnpkFlushSendData( CnpkCtx* pCnpk )
{
	int result = 0;
	char size_str[32];

	if( pCnpk->flgProc ){
		if( pCnpk->nBufSize > 0 ){
			snprintf(size_str, 31, "%d", pCnpk->nBufSize);
			if( cnprocWriteCommand(pCnpk->pipe_fds, CNPK_ID_SEND_DATA,
								   size_str, strlen(size_str)+1) == 0 ){
				cnprocWriteData(pCnpk->pipe_fds,
								pCnpk->bufPDLData, pCnpk->nBufSize );
			}
			if( (result = cnprocCheckResponse(pCnpk->pipe_fds,
										CNPK_ID_SEND_DATA, NULL, NULL)) == 0 )
				pCnpk->nBufSize = 0;
		}

		if( cnprocWriteCommand(pCnpk->pipe_fds, CNPK_ID_FLUSH_SEND_DATA,
							   NULL, 0) < 0 ){
			ErrorPrint( "cnpklib -->cnpkFlushSendData\n");
			goto write_error;
		}
		result = cnprocCheckResponse(pCnpk->pipe_fds, CNPK_ID_FLUSH_SEND_DATA,
									 NULL, NULL);
	}
	return result;

 write_error:
	return CNPK_ERROR;
}
开发者ID:random3231,项目名称:cndrvcups-lb,代码行数:31,代码来源:cnpklib.c


示例10: ExceptionFilter

ULONG 
ExceptionFilter (
    _In_ PEXCEPTION_POINTERS ExceptionPointers
    )
/*++

Routine Description:

    ExceptionFilter breaks into the debugger if an exception happens
    inside the callback.

Arguments:

    ExceptionPointers - unused

Return Value:

    Always returns EXCEPTION_CONTINUE_SEARCH

--*/
{

    ErrorPrint("Exception %lx, ExceptionPointers = %p", 
               ExceptionPointers->ExceptionRecord->ExceptionCode,
               ExceptionPointers);

    DbgBreakPoint();
    
    return EXCEPTION_EXECUTE_HANDLER;

}
开发者ID:0xhack,项目名称:Windows-driver-samples,代码行数:31,代码来源:util.c


示例11: SformatOutput

//
// Returns a pointer to the specified function.
//
static void *CalibrationFunctionFind(char *prefix, char *function)
{
    void *f;
    char buffer[MBUFFER];

    if(osCheckLibraryHandle(CalibrationLibrary)!=0)
    {
        //
        // try adding the prefix in front of the name
        //
        SformatOutput(buffer,MBUFFER-1,"%s%s",prefix,function);
        buffer[MBUFFER-1]=0;
 
        f=osGetFunctionAddress(buffer,CalibrationLibrary);

        if(f==0)
        {
			//
			// try without the prefix in front of the name
			//

            f=osGetFunctionAddress(function,CalibrationLibrary);

        }

        return f;
    }
	ErrorPrint(CalibrationLoadBad,prefix,function);
	CalibrationUnload();

    return 0;
}
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:35,代码来源:CalibrationLoad.c


示例12: ErrorPrint

bool CaptureAndSend::start()
{
	if (m_CurrentState == Running)
	{
		return true;
	}

	if (!m_NetSenderFilter->start())
	{
		return false;
	}

	HRESULT hr = S_OK;

	IGraphBuilder* graphBuilder;
	hr = m_FilterGraph->QueryInterface(IID_IGraphBuilder, (void**)&graphBuilder);
	if (FAILED(hr))
	{
		ErrorPrint("Get graph builder interface error",hr);
		return false;
	}
	ComReleaser graphBuilderReleaser(graphBuilder);

	IMediaControl* mediaControl;
	hr = m_FilterGraph->QueryInterface(IID_IMediaControl, (void**)&mediaControl);
	if(FAILED(hr))
	{
		ErrorPrint("Get media control error", hr);
		return false;
	}
	ComReleaser mediaControlReleaser(mediaControl);

	hr = mediaControl->Run();
	if(FAILED(hr))
	{
		ErrorPrint("Run error",hr);
		return false;
	}

	if (m_CurrentState == Stopped)
	{
		g_StartCount++;
	}
	m_CurrentState = Running;

	return true;
}
开发者ID:dalinhuang,项目名称:networkprogram,代码行数:47,代码来源:CaptrueAndSend.cpp


示例13: DetectOSVersion

VOID
DetectOSVersion()
/*++

Routine Description:

    This routine determines the OS version and initializes some globals used
    in the sample. 

Arguments:
    
    None
    
Return value:

    None. On failure, global variables stay at default value

--*/
{

    RTL_OSVERSIONINFOEXW VersionInfo = {0};
    NTSTATUS Status;
    ULONGLONG ConditionMask = 0;

    //
    // Set VersionInfo to Win7's version number and then use
    // RtlVerifVersionInfo to see if this is win8 or greater.
    //
    
    VersionInfo.dwOSVersionInfoSize = sizeof(VersionInfo);
    VersionInfo.dwMajorVersion = 6;
    VersionInfo.dwMinorVersion = 1;

    VER_SET_CONDITION(ConditionMask, VER_MAJORVERSION, VER_LESS_EQUAL);
    VER_SET_CONDITION(ConditionMask, VER_MINORVERSION, VER_LESS_EQUAL);



    Status = RtlVerifyVersionInfo(&VersionInfo,
                                  VER_MAJORVERSION | VER_MINORVERSION,
                                  ConditionMask);
    if (NT_SUCCESS(Status)) {
        g_IsWin8OrGreater = FALSE;
        InfoPrint("DetectOSVersion: This machine is running Windows 7 or an older OS.");
    } else if (Status == STATUS_REVISION_MISMATCH) {
        g_IsWin8OrGreater = TRUE;
        InfoPrint("DetectOSVersion: This machine is running Windows 8 or a newer OS.");
    } else {
        ErrorPrint("RtlVerifyVersionInfo returned unexpected error status 0x%x.",
            Status);

        //
        // default action is to assume this is not win8
        //
        g_IsWin8OrGreater = FALSE;  
    }
    
}
开发者ID:HDM1991,项目名称:ExampleLearn,代码行数:58,代码来源:driver.c


示例14: m_FilterGraph

CaptureAndSend::CaptureAndSend(IFilterGraph* filterGraph, IPin* capturePin):
m_FilterGraph(filterGraph),
m_CapturePin(capturePin),
m_CurrentState(Stopped)
{
	if (!initialCaptureAndSend())
	{
		ErrorPrint("Initial Capture and send error");
		throw std::runtime_error("Initial capture and send error");
	}
}
开发者ID:dalinhuang,项目名称:networkprogram,代码行数:11,代码来源:CaptrueAndSend.cpp


示例15: CalibrationGetCommand

int CalibrationGetCommand(int client)
{
	if(osCheckLibraryHandle(CalibrationLibrary)==0)
	{
		ErrorPrint(CalibrationMissing);
		return -1;
	}
	if(_CalGetCommand!=0)
    {
        _CalGetCommand(client);
    }
	else
	{
		ErrorPrint(CalibrationNoFunction,"Calibration_GetCommand");
		return -1;
	}
	return 0;


}
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:20,代码来源:CalibrationLoad.c


示例16: print9300_Header_newItems

void print9300_Header_newItems(int client, const ar9300_eeprom_t *ahp_Eeprom, int iBand)
{
	char eepItemName[100], eepItemValue[100];
	int itemNum;
	int emptyRight = 1;
	
	// print for ar9300Eeprom_switchcomspdt
	lc=0;
	itemNum = get_num_switchcomspdt();
	if (itemNum>0) {
		get_switchcomspdt(eepItemName, eepItemValue, itemNum-1, ahp_Eeprom, iBand);
		print9300_half_Line(eepItemName, eepItemValue, 1);
//		print9300_lineEnd(emptyRight);
	//	for second item	
//		print9300_half_Line(eepItemName, eepItemValue, 0);
//		print9300_lineEnd(0);
	}

	itemNum = get_num_xLNABiasStrength();
	if (itemNum>0) {
		get_xLNABiasStrength(eepItemName, eepItemValue, itemNum-1, ahp_Eeprom, iBand);
		print9300_half_Line(eepItemName, eepItemValue, 0);
		print9300_lineEnd(0);
	}

	itemNum = get_num_rfGainCap();
	if (itemNum>0) {
		get_rfGainCap(eepItemName, eepItemValue, itemNum-1, ahp_Eeprom, iBand);
		print9300_half_Line(eepItemName, eepItemValue, 1);
	}

	itemNum = get_num_txGainCap();
	if (itemNum>0) {
		get_txGainCap(eepItemName, eepItemValue, itemNum-1, ahp_Eeprom, iBand);
		print9300_half_Line(eepItemName, eepItemValue, 0);
		print9300_lineEnd(0);
	}

	if(iBand == band_A){
		// print for ar9300Eeprom_tempslopextension
		lc=0;
		itemNum = get_num_tempslopextension();
		if (itemNum>0) {
			get_tempslopextension(eepItemName, eepItemValue, itemNum-1, ahp_Eeprom);
			print9300_whole_Line(eepItemName, eepItemValue);
		}
	}


	// print a space line at the end of header print
	SformatOutput(buffer, MBUFFER-1," |                                   |                                   |");
	ErrorPrint(NartOther,buffer);
} 
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:53,代码来源:ar9300Eeprom_newItems.c


示例17: HCWarning

void HCWarning( int err_num, ... )
{
    ErrString   string = err_strings[err_num];
    va_list values;

    fputc( '\n', stderr );
    va_start( values, err_num );
    ErrorPrint( stderr, string, values );
    va_end( values );

    return;
}
开发者ID:Ukusbobra,项目名称:open-watcom-v2,代码行数:12,代码来源:hcerrors.cpp


示例18: UtilOpenDevice

BOOL 

UtilOpenDevice(
    _In_ LPTSTR szWin32DeviceName,
    _Out_ HANDLE *phDevice
    )
/*++

Routine Description:

    Opens a device

Arguments:

    szWin32DeviceName - name of the device

    phDevice - pointer to a variable that receives the handle to the device

Return Value:

    TRUE if the device is successfully opened, FALSE otherwise.

--*/
{
    BOOL ReturnValue = FALSE;
    HANDLE hDevice;

    //
    // Open the device
    //

    hDevice = CreateFile ( szWin32DeviceName,
                           GENERIC_READ | GENERIC_WRITE,
                           0,
                           NULL,
                           OPEN_EXISTING,
                           FILE_ATTRIBUTE_NORMAL,
                           NULL);

    if (hDevice == INVALID_HANDLE_VALUE) {
        ErrorPrint("CreateFile(%ls) failed, last error 0x%x", 
                    szWin32DeviceName, 
                    GetLastError() );
        goto Exit;
    }

    ReturnValue = TRUE;

Exit:

    *phDevice = hDevice;
    return ReturnValue;
}
开发者ID:340211173,项目名称:Windows-driver-samples,代码行数:53,代码来源:util.c


示例19: SleepModeCommand

void SleepModeCommand(int client)
{
    int error;
    char *name;
	int np, ip, ngot;
    int value, selection;

    //
	// prepare beginning of error message in case we need to use it
	//
	error=0;
	//
	//parse arguments and do it
	//
	np=CommandParameterMany();
	for(ip=0; ip<np; ip++)
	{
		name=CommandParameterName(ip);
		if (strlen(name)==0) continue;	// sometime there are tab or space at the end count as np with name as "", skip it

		selection=ParameterSelect(name,SleepModeParameter,sizeof(SleepModeParameter)/sizeof(SleepModeParameter[0]));
		switch(selection)
		{
			case SleepMode:
				ngot=SformatInput(CommandParameterValue(ip,0)," %d ",&value);
				if(ngot != 1 || (value < SleepModeMin || value > SleepModeMax))
				{
					ErrorPrint(ParseBadValue, CommandParameterValue(value, 0),"mode");
					error++;
				}
				break;
			default:
				break;
		}
	}
	if (error == 0)
	{
		if (CurrentSleepMode == value)
		{
			UserPrint("The device is currently in %s mode.\n", (value == SLEEP_MODE_SLEEP ? "sleep" :
				(value == SLEEP_MODE_WAKEUP ? "wakeup" : "deep sleep")));
		}
		else
		{
			SendOn(client);
			DeviceSleepMode(value);
			SendOff(client);
			CurrentSleepMode = value;
		}
	}
	SendDone(client);
}
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:52,代码来源:SleepMode.c


示例20: CalibrationSetCommand

int CalibrationSetCommand(int client)
{
	char *name, *calDllName;
	int np, index;

	// Check if the command is dll load first.
	np=CommandParameterMany();
	name=CommandParameterName(0);
	index=ParameterSelectIndex(name,&calDllLoadParameter,1);
    if(index == 0)
	{
		calDllName=CommandParameterValue(0,0);
		if(CalibrationLoad(calDllName)!=0)
		{
			return -1;
		}
		return 1;
	}

	// Following part will handle different cal parameter set commands

	// First check if calibration dll was loaded before.
	if(osCheckLibraryHandle(CalibrationLibrary)==0)
	{
		ErrorPrint(CalibrationMissing);
		return -1;
	}

	if(_CalSetCommand!=0)
    {
        _CalSetCommand(client);
    }
	else
	{
		ErrorPrint(CalibrationNoFunction,"Calibration_SetCommand");
		return -1;
	}
	return 0;
}
开发者ID:KHATEEBNSIT,项目名称:AP,代码行数:39,代码来源:CalibrationLoad.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ ErrorToException函数代码示例发布时间:2022-05-30
下一篇:
C++ ErrorMessageBox函数代码示例发布时间: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