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

C++ PrintErrorMessage函数代码示例

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

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



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

示例1: AddIPv4ToFilter

TApiStatus AddIPv4ToFilter(TFilterData* filter,
    TIPAddressType addr_type, char* ip_addr, int mask)
{
    // Convert IPv4 string address to struct
    if(strlen(ip_addr) >= INET_ADDRSTRLEN)
    {
       PrintErrorMessage("AddIPv4ToFilter", "IP address is too long");
       return API_ERROR;
    }

    // Check mask
    if(mask < 0 || mask > 32)
    {
       PrintErrorMessage("AddIPv4ToFilter", "Mask is out of {0,1,...,32}");
       return API_ERROR;
    }

    // Save to data structure
    switch(addr_type)
    {
        case SRC:
            filter->src_ip = ip_addr;
            filter->src_mask = mask;
           break;
        case DST:
            filter->dst_ip = ip_addr;
            filter->dst_mask = mask;
            break;
        default:
            PrintErrorMessage("AddIPv4ToFilter", "Wrong address type");
            return API_ERROR;
    }

    return API_OK;
}
开发者ID:samuel-kollat,项目名称:Tahoe,代码行数:35,代码来源:api.c


示例2: Call

bool LuaManager::ProtectedCall(int narg, int nresults)
{
	try
	{
		Call(narg, nresults);
	}
	catch (luabind::error e)
	{
		m_bSuccess = false;
		if (lua->IsString())
		{
			PrintErrorMessage(lua->GetString(), true, true);
			lua->Pop();
		}
		else
			PrintErrorMessage("LuaManager::ProtectedCall failed - luabind::error thrown, but not error message in stack!", true, false);
	}
	catch (...)
	{
		PrintErrorMessage("LuaManager::ProtectedCall failed - Unhandled Exception", true, true);
		m_bSuccess = false;
	}

	return m_bSuccess;
}
开发者ID:FUCKINGBLASTGAMER,项目名称:GTALua,代码行数:25,代码来源:LuaManager.cpp


示例3: AddPortToFilter

TApiStatus AddPortToFilter(TFilterData* filter,
    TIPAddressType addr_type, int port)
{
    // Check port
    if(port < 0 || port > 65535)
    {
       PrintErrorMessage("AddPortToFilter", "Port is out of {0,1,...,65535}");
       return API_ERROR;
    }

    // Save to data structure
    switch(addr_type)
    {
        case SRC:
           filter->src_port = port;
           break;
        case DST:
           filter->dst_port = port;
           break;
        default:
            PrintErrorMessage("AddPortToFilter", "Wrong port type");
            return API_ERROR;
    }

    return API_OK;
}
开发者ID:samuel-kollat,项目名称:Tahoe,代码行数:26,代码来源:api.c


示例4: SetInterfaceOnNetworkElement

TApiStatus SetInterfaceOnNetworkElement(TNetworkElement* element,
    char* interface)
{
    onep_status_t rc;

    // Discover active interfaces if needed
    if(element->interfaces == NULL)
    {
        TApiStatus s = GetInterfacesOnNetworkElement(element);
        if(s != API_OK)
        {
            PrintErrorMessage("SetInterfaceOnNetworkElement", "get interfaces");
            return API_ERROR;
        }
    }

    // Set interface
    TInterfaceItem* intf_item = (TInterfaceItem*)(malloc(sizeof(TInterfaceItem)));
    rc = onep_element_get_interface_by_name(element->ne, interface, &(intf_item->interface));
    if (rc != ONEP_OK) {
        PrintErrorMessage("SetInterfaceOnNetworkElement", onep_strerror(rc));
        return API_ERROR;
    }

    // Add it to list
    intf_item->next = element->interface_list;
    element->interface_list = intf_item;

    return API_OK;
}
开发者ID:samuel-kollat,项目名称:Tahoe,代码行数:30,代码来源:api.c


示例5: ADCSendCommand

/* ===================================================================*/
LDD_TError ADCSendCommand(byte* cmd, uint8 len)
{
    LDD_TError err;
    
    /* Check the command. */
    err = CheckCommand(*cmd, len);
    if(err != ERR_OK)
    {
        PrintErrorMessage(err);
        return err;
    }
    
    /* Prepare the buffer of command transmitted to ADC. */
    err = SPI1Send(cmd, len);
    if(err != ERR_OK)
    {
        PrintErrorMessage(err);         /* If error occurred, print the error message, */
        return err;                     /* then return error type. */
    }
    
    /* Enable the SPI transmission interrupt to transmit. */
    SPI1EnableTxInterrupt();
    
    return err;
}
开发者ID:lsyslsy,项目名称:semg_mkl15z128vlh4,代码行数:26,代码来源:ADC.c


示例6: PrintErrorMessage

void Preprocessor::ParsePragma( LexemList& args )
{
    args.pop_front();
    if( args.empty() )
    {
        PrintErrorMessage( "Pragmas need arguments." );
        return;
    }
    std::string p_name = args.begin()->Value;
    args.pop_front();
    std::string p_args;
    if( !args.empty() )
    {
        if( args.begin()->Type != Lexem::STRING )
            PrintErrorMessage( "Pragma parameter should be a string literal." );
        p_args = RemoveQuotes( args.begin()->Value );
        args.pop_front();
    }
    if( !args.empty() )
        PrintErrorMessage( "Too many parameters to pragma." );

    Pragmas.push_back( p_name );
    Pragmas.push_back( p_args );

    Pragma::Instance pi;
    pi.Text = p_args;
    pi.CurrentFile = CurrentFile;
    pi.CurrentFileLine = LinesThisFile;
    pi.RootFile = RootFile;
    pi.GlobalLine = CurrentLine;
    if( CurPragmaCallback )
        CurPragmaCallback->CallPragma( p_name, pi );
}
开发者ID:basecq,项目名称:angelscript-preprocessor,代码行数:33,代码来源:preprocessor.cpp


示例7: NPTSolverExecute

INT NPTSolverExecute (NP_BASE *theNP, INT argc , char **argv)
{
  NP_T_SOLVER *np;
  INT result,level;

  np = (NP_T_SOLVER *) theNP;
  level = CURRENTLEVEL(theNP->mg);

  if (np->y == NULL) {
    PrintErrorMessage('E',"NPTSolverExecute","no vector y");
    return (1);
  }
  if (np->tass == NULL) {
    PrintErrorMessage('E',"NPTSolverExecute","no assemble num proc");
    return (1);
  }
  if (np->nlsolve == NULL) {
    PrintErrorMessage('E',"NPTSolverExecute","no solver num proc");
    return (1);
  }

  if (ReadArgvOption("i",argc,argv)) {
    if (*np->TimePreProcess != NULL)
      if ((*np->TimePreProcess)(np,level,&result)) {
        UserWriteF("NPTSolverExecute: TimePreProcess failed, error code %d\n",
                   result);
        return (1);
      }
  }

  if (ReadArgvOption("0",argc,argv)) {
    if (*np->TimeInit != NULL)
      if ((*np->TimeInit)(np,level,&result)) {
        UserWriteF("NPTSolverExecute: TimeInit failed, error code %d\n",
                   result);
        return (1);
      }
  }

  if (ReadArgvOption("s",argc,argv)) {
    if (*np->TimeStep != NULL)
      if ((*np->TimeStep)(np,level,&result)) {
        UserWriteF("NPTSolverExecute: TimeStep failed, error code %d\n",
                   result);
        return (1);
      }
  }

  if (ReadArgvOption("p",argc,argv)) {
    if (*np->TimePostProcess != NULL)
      if ((*np->TimePostProcess)(np,level,&result)) {
        UserWriteF("NPTSolverExecute: TimePostProcess failed, error code %d\n",
                   result);
        return (1);
      }
  }

  return(0);
}
开发者ID:rolk,项目名称:ug,代码行数:59,代码来源:ts.c


示例8: OpenAndMergeVHD

BOOL OpenAndMergeVHD(PCWSTR pszVhdPath)
{
    BOOL bRet = FALSE;
    DWORD ret;
    HANDLE hVhd;
    MERGE_VIRTUAL_DISK_PARAMETERS mparms;
    OPEN_VIRTUAL_DISK_PARAMETERS oparms;
    MERGE_VIRTUAL_DISK_FLAG flags = MERGE_VIRTUAL_DISK_FLAG_NONE;
    VIRTUAL_STORAGE_TYPE            vst =
    {
        VIRTUAL_STORAGE_TYPE_DEVICE_VHD,
        VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT
    };

    wprintf(L"OpenAndMergeVHD %s\n", pszVhdPath);

    oparms.Version = OPEN_VIRTUAL_DISK_VERSION_1;
    oparms.Version1.RWDepth = 2;

    ret = OpenVirtualDisk(&vst, pszVhdPath,
        VIRTUAL_DISK_ACCESS_METAOPS | VIRTUAL_DISK_ACCESS_GET_INFO,
        OPEN_VIRTUAL_DISK_FLAG_NONE, &oparms, &hVhd);

    if (ERROR_SUCCESS == ret) 
    {
        printf("success opening vdisk...\n");

        mparms.Version = MERGE_VIRTUAL_DISK_VERSION_1;
        mparms.Version1.MergeDepth = oparms.Version1.RWDepth - 1; //MERGE_VIRTUAL_DISK_DEFAULT_MERGE_DEPTH;

        ret = MergeVirtualDisk(hVhd, flags, &mparms, NULL);

        if (ERROR_SUCCESS == ret) 
        {
            printf("success merging vdisk...\n");
            bRet = TRUE;
        }
        else 
        {
            printf("failed to expand vdisk... %d\n", ret);
            PrintErrorMessage(GetLastError());
            bRet = FALSE;
        }
    } 
    else
    {
        printf("failed to open vdisk...err %d\n", ret);
        PrintErrorMessage(GetLastError());
        bRet = FALSE;
    }

    if (INVALID_HANDLE_VALUE != hVhd)
    {
        CloseHandle(hVhd);
    }

    return bRet;
}
开发者ID:ljvankuiken,项目名称:CppVhdAPI,代码行数:58,代码来源:CppVhdAPI.cpp


示例9: PrintErrorMessage

GLboolean FWindow::Linux_Initialize()
{
	Attributes = new GLint[12]{GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, DepthBits, GLX_STENCIL_SIZE, StencilBits,
	   GLX_RED_SIZE, ColourBits, GLX_GREEN_SIZE, ColourBits, GLX_BLUE_SIZE, ColourBits, None};

	Decorators = 1;
	CurrentWindowStyle |= LINUX_DECORATOR_CLOSE | LINUX_DECORATOR_MAXIMIZE | LINUX_DECORATOR_MINIMIZE | LINUX_DECORATOR_MOVE;

	if (!WindowManager::GetDisplay())
	{
		PrintErrorMessage(ERROR_LINUX_CANNOTCONNECTXSERVER);
		exit(0);
	}

	VisualInfo = glXGetVisualFromFBConfig(WindowManager::GetDisplay(), GetBestFrameBufferConfig()); 

	//VisualInfo = glXChooseVisual(WindowManager::GetDisplay(), 0, Attributes);

	if (!VisualInfo)
	{
		PrintErrorMessage(ERROR_LINUX_INVALIDVISUALINFO);
		exit(0);
	}

	SetAttributes.colormap = XCreateColormap(WindowManager::GetDisplay(),
		DefaultRootWindow(WindowManager::GetDisplay()),
		VisualInfo->visual, AllocNone);

	SetAttributes.event_mask = ExposureMask | KeyPressMask 
	   	| KeyReleaseMask | MotionNotify | ButtonPressMask | ButtonReleaseMask
	   	| FocusIn | FocusOut | Button1MotionMask | Button2MotionMask | Button3MotionMask | 
		Button4MotionMask | Button5MotionMask | PointerMotionMask | FocusChangeMask
		| VisibilityChangeMask | PropertyChangeMask | SubstructureNotifyMask;

	WindowHandle = XCreateWindow(WindowManager::GetInstance()->m_Display,
		XDefaultRootWindow(WindowManager::GetInstance()->m_Display), 0, 0,
		Resolution[0], Resolution[1],
		0, VisualInfo->depth, InputOutput,
		VisualInfo->visual, CWColormap | CWEventMask,
		&SetAttributes);

	if(!WindowHandle)
	{
		PrintErrorMessage(ERROR_LINUX_CANNOTCREATEWINDOW);
		exit(0);
	}

	XMapWindow(WindowManager::GetDisplay(), WindowHandle);
	XStoreName(WindowManager::GetDisplay(), WindowHandle,
		Name);

	InitializeAtomics();

	XSetWMProtocols(WindowManager::GetDisplay(), WindowHandle, &AtomClose, GL_TRUE);	

	return Linux_InitializeGL();
}
开发者ID:ezhangle,项目名称:Window-API,代码行数:57,代码来源:Window_Linux.cpp


示例10: OpenAndGetPhysVHD

BOOL OpenAndGetPhysVHD(PCWSTR pszVhdPath, PWSTR pszPhysicalDiskPath)
{    
    BOOL bRet = FALSE;
    HANDLE hVhd = INVALID_HANDLE_VALUE;
    DWORD ret;
    OPEN_VIRTUAL_DISK_PARAMETERS oparams;
    ATTACH_VIRTUAL_DISK_PARAMETERS iparams;
    VIRTUAL_STORAGE_TYPE            vst =
    {
        VIRTUAL_STORAGE_TYPE_DEVICE_VHD,
        VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT
    };

    wprintf(L"OpenAndGetPhysVHD %s\n", pszVhdPath);

    oparams.Version = OPEN_VIRTUAL_DISK_VERSION_1;
    oparams.Version1.RWDepth = OPEN_VIRTUAL_DISK_RW_DEPTH_DEFAULT;

    iparams.Version = ATTACH_VIRTUAL_DISK_VERSION_1;

    ret = OpenVirtualDisk(&vst, pszVhdPath,
        VIRTUAL_DISK_ACCESS_ATTACH_RW | VIRTUAL_DISK_ACCESS_GET_INFO | VIRTUAL_DISK_ACCESS_DETACH,
        OPEN_VIRTUAL_DISK_FLAG_NONE, &oparams, &hVhd);

    if (ERROR_SUCCESS == ret) 
    {
        ULONG sizePhysicalDisk;
        printf("success opening vdisk...\n");
        memset(pszPhysicalDiskPath, 0, sizeof (wchar_t) * PHYS_PATH_LEN);
        sizePhysicalDisk = (PHYS_PATH_LEN * sizeof(wchar_t)) * 256;
        ret = GetVirtualDiskPhysicalPath(hVhd, &sizePhysicalDisk, pszPhysicalDiskPath);
        if (ERROR_SUCCESS == ret)
        {
            wprintf(L"success getting physical path %s vhdname\n", pszPhysicalDiskPath);
            bRet = TRUE;
        }
        else
        {
            printf("failed to get vhd physical info %d\n", ret);
            PrintErrorMessage(GetLastError());
        }
    } 
    else 
    {
        printf("failed to open vdisk...err 0x%x\n", ret);
        PrintErrorMessage(GetLastError());
    }

    if (INVALID_HANDLE_VALUE != hVhd) 
    {
        CloseHandle(hVhd);
    }

    return bRet;
}
开发者ID:ljvankuiken,项目名称:CppVhdAPI,代码行数:55,代码来源:CppVhdAPI.cpp


示例11: OpenAndAttachVHD

BOOL OpenAndAttachVHD(PCWSTR pszVhdPath)
{
    BOOL bRet = FALSE;
    HANDLE hVhd = INVALID_HANDLE_VALUE;
    DWORD ret;
    OPEN_VIRTUAL_DISK_PARAMETERS oparams;
    ATTACH_VIRTUAL_DISK_PARAMETERS iparams;
    VIRTUAL_STORAGE_TYPE            vst =
    {
        VIRTUAL_STORAGE_TYPE_DEVICE_VHD,
        VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT
    };

    wprintf(L"OpenAndAttachVHD %s\n", pszVhdPath);

    oparams.Version = OPEN_VIRTUAL_DISK_VERSION_1;
    oparams.Version1.RWDepth = OPEN_VIRTUAL_DISK_RW_DEPTH_DEFAULT;

    iparams.Version = ATTACH_VIRTUAL_DISK_VERSION_1;

    ret = OpenVirtualDisk(&vst, pszVhdPath,
        VIRTUAL_DISK_ACCESS_ATTACH_RW | VIRTUAL_DISK_ACCESS_GET_INFO | VIRTUAL_DISK_ACCESS_DETACH,
        OPEN_VIRTUAL_DISK_FLAG_NONE, &oparams, &hVhd);

    if (ERROR_SUCCESS == ret) 
    {
        printf("success opening vdisk...\n");
        ret = AttachVirtualDisk(hVhd, NULL, 
            ATTACH_VIRTUAL_DISK_FLAG_PERMANENT_LIFETIME, 0, &iparams, NULL);

        if (ERROR_SUCCESS == ret) 
        {
            printf("success attaching vdisk...\n");
        }
        else
        {
            printf("failed to attach vdisk...err 0x%x\n", ret);
            PrintErrorMessage(GetLastError());
            bRet = FALSE;
        }
    }
    else
    {
        printf("failed to open vdisk...err 0x%x\n", ret);
        PrintErrorMessage(GetLastError());
        bRet = FALSE;
    }

    if (INVALID_HANDLE_VALUE != hVhd)
    {
        CloseHandle(hVhd);
    }

    return bRet;
}
开发者ID:ljvankuiken,项目名称:CppVhdAPI,代码行数:55,代码来源:CppVhdAPI.cpp


示例12: OpenAndDetachVHD

BOOL OpenAndDetachVHD(PCWSTR pszVhdPath)
{
    BOOL bRet = FALSE;
    DWORD ret;
    DETACH_VIRTUAL_DISK_FLAG Flags;
    HANDLE hVhd = INVALID_HANDLE_VALUE;
    OPEN_VIRTUAL_DISK_PARAMETERS oparams;
    VIRTUAL_STORAGE_TYPE            vst =
    {
        VIRTUAL_STORAGE_TYPE_DEVICE_VHD,
        VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT
    };

    wprintf(L"OpenAndDetachVHD %s\n", pszVhdPath);

    oparams.Version = OPEN_VIRTUAL_DISK_VERSION_1;
    oparams.Version1.RWDepth = OPEN_VIRTUAL_DISK_RW_DEPTH_DEFAULT;

    ret = OpenVirtualDisk(&vst, pszVhdPath,
        VIRTUAL_DISK_ACCESS_DETACH,
        OPEN_VIRTUAL_DISK_FLAG_NONE, NULL /*&oparams*/, &hVhd);

    if (ERROR_SUCCESS == ret) 
    {
        printf("success opening vdisk...\n");
        Flags = DETACH_VIRTUAL_DISK_FLAG_NONE;
        ret = DetachVirtualDisk(hVhd, Flags, 0);
        if (ERROR_SUCCESS == ret)
        {
            printf("success detaching vdisk...\n");
        }
        else
        {
            printf("failed to detach vdisk... %d\n", ret);
            PrintErrorMessage(GetLastError());
            bRet = FALSE;
        }
    }
    else
    {
        printf("failed to open vdisk...err %d\n", ret);
        PrintErrorMessage(GetLastError());
        bRet = FALSE;
    }

    if (INVALID_HANDLE_VALUE != hVhd)
    {
        CloseHandle(hVhd);
    }

    return bRet;
}
开发者ID:ljvankuiken,项目名称:CppVhdAPI,代码行数:52,代码来源:CppVhdAPI.cpp


示例13: OpenAndSetVHDInfo

int OpenAndSetVHDInfo(PCWSTR pszVhdPath, PCWSTR pszGuid, GUID *Guid)
{
    BOOL bRet = FALSE;
    DWORD ret;
    HANDLE hVhd;
    ULONG InfoSize;
    SET_VIRTUAL_DISK_INFO SetInfo;
    VIRTUAL_STORAGE_TYPE            vst =
    {
        VIRTUAL_STORAGE_TYPE_DEVICE_VHD,
        VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT
    };

    wprintf(L"OpenAndSetVHDInfo %s GUID %s\n", pszVhdPath, pszGuid);

    ret = OpenVirtualDisk(&vst, pszVhdPath, 
        VIRTUAL_DISK_ACCESS_ALL, OPEN_VIRTUAL_DISK_FLAG_NONE, 
        NULL, &hVhd);

    if (ERROR_SUCCESS == ret) 
    {
        printf("success opening vdisk...\n");

        SetInfo.Version = SET_VIRTUAL_DISK_INFO_IDENTIFIER;
        InfoSize = sizeof(SetInfo);
        SetInfo.UniqueIdentifier = zGuid; //*Guid;

        ret = SetVirtualDiskInformation(hVhd, &SetInfo);
        if (ret == ERROR_SUCCESS) 
        {
            printf("success setting vhd info\n");
        }
        else
        {
            printf("failed to set vhd info %d\n", ret);
            PrintErrorMessage(GetLastError());
        }
    }
    else
    {
        printf("failed to open vdisk...err %d\n", ret);
        PrintErrorMessage(GetLastError());
    }

    if (INVALID_HANDLE_VALUE != hVhd) 
    {
        CloseHandle(hVhd);
    }

    return bRet;
}
开发者ID:ljvankuiken,项目名称:CppVhdAPI,代码行数:51,代码来源:CppVhdAPI.cpp


示例14: OpenAndExpandVHD

// Expanding a virtual disk requires that the virtual disk be detached during 
// the operation.
BOOL OpenAndExpandVHD(PCWSTR pszVhdPath, ULONG newSizeMB)
{
    BOOL bRet = FALSE;
    DWORD ret;
    HANDLE hVhd = INVALID_HANDLE_VALUE;
    EXPAND_VIRTUAL_DISK_PARAMETERS xparams;
    VIRTUAL_STORAGE_TYPE            vst =
    {
        VIRTUAL_STORAGE_TYPE_DEVICE_VHD,
        VIRTUAL_STORAGE_TYPE_VENDOR_MICROSOFT
    };

    wprintf(L"OpenAndExpandVHD %s, new size (MB) %d\n", pszVhdPath, newSizeMB);

    ret = OpenVirtualDisk(&vst, pszVhdPath,
        VIRTUAL_DISK_ACCESS_METAOPS,
        OPEN_VIRTUAL_DISK_FLAG_NONE, NULL, &hVhd);

    if (ERROR_SUCCESS == ret) 
    {
        printf("success opening vdisk...\n");
        xparams.Version = EXPAND_VIRTUAL_DISK_VERSION_1;
        xparams.Version1.NewSize = newSizeMB * 1024 * 1024;

        ret = ExpandVirtualDisk(hVhd, EXPAND_VIRTUAL_DISK_FLAG_NONE, &xparams, 0);

        if (ERROR_SUCCESS == ret) 
        {
            printf("success expanding vdisk...\n");
        }
        else
        {
            printf("failed to expand vdisk... %d\n", ret);
            PrintErrorMessage(GetLastError());
            bRet = FALSE;
        }
    }
    else
    {
        printf("failed to open vdisk...err %d\n", ret);
        PrintErrorMessage(GetLastError());
        bRet = FALSE;
    }

    if (INVALID_HANDLE_VALUE != hVhd)
    {
        CloseHandle(hVhd);
    }

    return bRet;
}
开发者ID:ljvankuiken,项目名称:CppVhdAPI,代码行数:53,代码来源:CppVhdAPI.cpp


示例15: WriteFile

static void WriteFile( char* fileName, void* data, int dataToWrite ) {
	HANDLE fileHandle;
	//TODO: look into other options, such as: Overlapped, No_Bufffering, and Random_Access
	fileHandle = CreateFile( 
		fileName, 
		GENERIC_WRITE, 
		FILE_SHARE_READ | FILE_SHARE_WRITE, 
		0, 
		CREATE_NEW, 
		FILE_ATTRIBUTE_NORMAL, 
		0 
	);
	if( fileHandle == INVALID_HANDLE_VALUE ) {
		fileHandle = CreateFile(
			fileName, 
			GENERIC_WRITE, 
			FILE_SHARE_WRITE,
			0,
			TRUNCATE_EXISTING,
			FILE_ATTRIBUTE_NORMAL,
			0
		);

		if( fileHandle == INVALID_HANDLE_VALUE ) {
			PrintErrorMessage( GetLastError() );
			printf("Did not write to file %s\n", fileName );
			return;
		}
	}

	DWORD bytesWritten = 0;
	DWORD writeSuccess = WriteFile( 
		fileHandle, 
		data, 
		dataToWrite, 
		&bytesWritten, 
		NULL //NOT NULL if i ever do overlapped stuff according to msdn
	);

	if( writeSuccess != 1 ) {
		PrintErrorMessage( GetLastError() );
		printf("Did not write to file %s\n", fileName );
		return;
	}

	//Close
	BOOL closeReturnValue = CloseHandle( fileHandle );
	assert( closeReturnValue );
}
开发者ID:tgolebiowski,项目名称:LimestoneCode,代码行数:49,代码来源:WinMain.cpp


示例16: Test_Print_Local_Info

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Description:
	This function prints information of local device
Arguments:
	void
Return:
	void 
---------------------------------------------------------------------------*/
void Test_Print_Local_Info(void)
{
	int j = 0;
	BTUINT8 szName[BTSDK_DEVNAME_LEN] = {0};
	BTUINT8 szBDAddr[BTSDK_BDADDR_LEN] = {0};
	BTUINT32 ulDevClass = 0;
	BTUINT16 usMode = 0;
	BTUINT16 usLen = BTSDK_DEVNAME_LEN;

	printf("\n");

	/* display the local device name */
	PrintErrorMessage(Btsdk_GetLocalName(szName, &usLen), BTSDK_TRUE);
	printf("Local Name = \"%s\"\n", szName);

	/* display the Bluetooth Address of the local device */
	PrintErrorMessage(Btsdk_GetLocalDeviceAddress(szBDAddr), BTSDK_TRUE);
	printf("BD Addr: ");
	for(j = 5; j > 0; j--)
	{
		printf("%02X:", szBDAddr[j]);
	}
	printf("%02X\n", szBDAddr[0]);

	/* display the device class of the local device */
	PrintErrorMessage(Btsdk_GetLocalDeviceClass(&ulDevClass), BTSDK_TRUE);
	printf("Device Class: %08lX\n", ulDevClass);

	/* display the discovery mode of the local device */
	PrintErrorMessage(Btsdk_GetDiscoveryMode(&usMode), BTSDK_TRUE);
	printf("Discovery Mode: ");
	if (usMode & BTSDK_GENERAL_DISCOVERABLE)
	{
		printf("GENERAL_DISCOVERABLE |");
	}
	if (usMode & BTSDK_LIMITED_DISCOVERABLE)
	{
		printf(" LIMITED_DISCOVERABLE |");
	}
	if (usMode & BTSDK_CONNECTABLE)
	{
		printf(" CONNECTABLE |");
	}
	if (usMode & BTSDK_PAIRABLE)
	{
		printf(" PAIRABLE\n");
	}
	printf("\n");	
}
开发者ID:uri247,项目名称:lib,代码行数:57,代码来源:loc_dev_tst.c


示例17: switch

void
AsyncChannel::ReportConnectionError(const char* channelName) const
{
    const char* errorMsg;
    switch (mChannelState) {
    case ChannelClosed:
        errorMsg = "Closed channel: cannot send/recv";
        break;
    case ChannelOpening:
        errorMsg = "Opening channel: not yet ready for send/recv";
        break;
    case ChannelTimeout:
        errorMsg = "Channel timeout: cannot send/recv";
        break;
    case ChannelClosing:
        errorMsg = "Channel closing: too late to send/recv, messages will be lost";
        break;
    case ChannelError:
        errorMsg = "Channel error: cannot send/recv";
        break;

    default:
        NS_RUNTIMEABORT("unreached");
    }

    PrintErrorMessage(mChild, channelName, errorMsg);

    mListener->OnProcessingError(MsgDropped);
}
开发者ID:marshall,项目名称:mozilla-central,代码行数:29,代码来源:AsyncChannel.cpp


示例18: BubbleSortForwardList

static
void BubbleSortForwardList(My402List *pList)
{
    My402ListElem *elem=NULL;
    int i=0;

    if (My402ListLength(pList) == 0) {
        fprintf(stderr, "List is empty!");
        PrintErrorMessage();
        exit(1);
    }
    for (i=0; i < My402ListLength(pList); i++) {
        int j=0, something_swapped=FALSE;
        My402ListElem *next_elem=NULL;

        for (elem=My402ListFirst(pList), j=0; j < My402ListLength(pList)-i-1; elem=next_elem, j++) {
           unsigned int cur_val=(unsigned int)((TransactionElem *)(elem->obj))->eleTime, next_val=0;

            next_elem=My402ListNext(pList, elem);
            next_val = (unsigned int)((TransactionElem *)(next_elem->obj))->eleTime;

            if (cur_val > next_val) {
                BubbleForward(pList, &elem, &next_elem);
                something_swapped = TRUE;
            }
        }
        if (!something_swapped) break;
    }
}
开发者ID:saigeethakandepallicherukuru,项目名称:cs402,代码行数:29,代码来源:warmup1.c


示例19: State

// ====================================================================================================
// Include File
// ====================================================================================================
bool LuaManager::IncludeFile(char* sPath)
{
	lua_State* L = State();

	// Load File
	int status = luaL_loadfile(L, sPath);
	m_bSuccess = (status == 0);

	// Check for errors
	if (!Success())
	{
		// Traceback
		lua->GetGlobal("debug");
		lua->GetField("traceback");
		lua->ProtectedCall(0, 1);
		lua->Remove(-3);
		lua->Remove(-2);

		// Error Message
		char eMsg[364];
		sprintf(eMsg, "%s\n%s", lua->GetString(-2), lua->GetString(-1));
		PrintErrorMessage(eMsg, true, true);

		lua->Pop(2);		
		return false;
	}

	// Execute File
	bool bStatus = ProtectedCall(0, LUA_MULTRET);
	lua->Pop();
	return bStatus;
}
开发者ID:FUCKINGBLASTGAMER,项目名称:GTALua,代码行数:35,代码来源:LuaManager.cpp


示例20: InitEnrol

INT NS_DIM_PREFIX InitEnrol ()
{
  /* install the /Formats directory */
  if (ChangeEnvDir("/")==NULL)
  {
    PrintErrorMessage('F',"InitEnrol","could not changedir to root");
    return(__LINE__);
  }
  theFormatDirID = GetNewEnvDirID();
  if (MakeEnvItem("Formats",theFormatDirID,sizeof(ENVDIR))==NULL)
  {
    PrintErrorMessage('F',"InitEnrol","could not install '/Formats' dir");
    return(__LINE__);
  }
  theSymbolVarID = GetNewEnvVarID();

  return (GM_OK);
}
开发者ID:rolk,项目名称:ug,代码行数:18,代码来源:enrol.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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