本文整理汇总了C++中ErrorPrint函数的典型用法代码示例。如果您正苦于以下问题:C++ ErrorPrint函数的具体用法?C++ ErrorPrint怎么用?C++ ErrorPrint使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ErrorPrint函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 );
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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");
}
}
示例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;
}