这篇教程C++ wprintf_s函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中wprintf_s函数的典型用法代码示例。如果您正苦于以下问题:C++ wprintf_s函数的具体用法?C++ wprintf_s怎么用?C++ wprintf_s使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了wprintf_s函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: showResultsvoid showResults( List* resultsList, Item* resultsLevel ){ // Display header wprintf_s( TEXT( " %19s %47s %12s %s/n" ), TEXT( "Date Modified" ), TEXT( "Coords" ), TEXT( "Size" ), TEXT( "Name" ) ); wprintf_s( TEXT( " %19s %47s %12s %s/n" ), TEXT( "-------------------" ), TEXT( "-----------------------------------------------" ), TEXT( "------------" ), TEXT( "--------------------------------" ) ); // Display founded entries Traverse( resultsList, showItem ); // Display totals wprintf_s( TEXT( " %19s %47s %12s %s/n" ), TEXT( "-------------------" ), TEXT( "-----------------------------------------------" ), TEXT( "------------" ), TEXT( "--------------------------------" ) ); showItem( resultsLevel );}
开发者ID:traillog,项目名称:LocBench,代码行数:27,
示例2: BadParametersvoid BadParameters(){ wprintf_s(L"Program have to run with one of these pamateres: /n"); wprintf_s(L" -l list of current process with name and ID /n"); wprintf_s(L" -d details about own process /n"); wprintf_s(L" -k application creates child process and terminate it");}
开发者ID:djdominoSVK,项目名称:SchoolStuff,代码行数:7,
示例3: DumpSectionHeadersBOOL DumpSectionHeaders(IMAGE_NT_HEADERS *pNTHeaders){ ASSERT(pNTHeaders != NULL); PIMAGE_SECTION_HEADER pFirstSecHeader = (PIMAGE_SECTION_HEADER)((DWORD)pNTHeaders + (DWORD)sizeof(pNTHeaders->Signature) + (DWORD)IMAGE_SIZEOF_FILE_HEADER + (DWORD)pNTHeaders->FileHeader.SizeOfOptionalHeader);#ifdef _DEBUG PIMAGE_SECTION_HEADER pFirstSecHeader_Verify = IMAGE_FIRST_SECTION(pNTHeaders); if (!(pFirstSecHeader == pFirstSecHeader_Verify)) { wprintf_s(L"Error calculating address of first section header./n"); return FALSE; }#endif PIMAGE_SECTION_HEADER pCurSecHeader = pFirstSecHeader; // wprintf_s(L"/n* IMAGE_SECTION_HEADER */n"); wprintf_s(L"%-8s %10s %10s %11s %8s/n", L"Name", L"VirtAddr", L"PtrRawData", L"RawDataSize", L"VirtSize"); for (DWORD i = 0; i < pNTHeaders->FileHeader.NumberOfSections; ++i, ++pCurSecHeader) { wprintf_s(L"%-8S 0x%08x 0x%08x 0x%08x 0x%08x/n", pCurSecHeader->Name, pCurSecHeader->VirtualAddress, pCurSecHeader->PointerToRawData, pCurSecHeader->SizeOfRawData, pCurSecHeader->Misc.VirtualSize); }// for i return TRUE;}// DumpSectionHeaders()
开发者ID:shishir993,项目名称:dasm,代码行数:32,
示例4: wprintf_s/////////////////////////////////////////////////////////////////////////////////// CSensorManagerEvents::GetSensorProperty//// Description of function/method:// Retrieves sensor properties to be stored for future reference//// Parameters:// SENSOR_ID SensorID: Unique ID for sensor used as Key to std::MAP // ISensor* pSensor: Sensor to be queried // REFPROPERTYKEY pk: Property to be set, currently only Name is stored//// Return Values:// S_OK on success, else an error/////////////////////////////////////////////////////////////////////////////////HRESULT CSensorManagerEvents::GetSensorProperty(SENSOR_ID SensorID, ISensor* pSensor, REFPROPERTYKEY pk){ HRESULT hr = S_OK; PROPVARIANT pv = {}; hr = pSensor->GetProperty(pk, &pv); if(SUCCEEDED(hr)) { if(pv.vt == VT_UI4) // Number { wprintf_s(L"/nSensor integer value: %u/n", pv.ulVal); } else if(pv.vt == VT_LPWSTR) // String { if(pk == SENSOR_PROPERTY_FRIENDLY_NAME) { int size = (int)wcslen(pv.pwszVal)+1; m_Properties[SensorID].m_Name = (WCHAR*)malloc(size*sizeof(WCHAR)); wsprintf(m_Properties[SensorID].m_Name,L"%s",pv.pwszVal); } } else // Interface or vector { wprintf_s(L"/nSensor property is a compound type. Unable to print value."); } } PropVariantClear(&pv); return hr; }
开发者ID:flair2005,项目名称:Windows-Desktop-Sensors,代码行数:48,
示例5: wmainint wmain(int argc, wchar_t* argv[]){ argc; argv; float c1[3] = { -1.f, 0.f, 0.f }; float c2[3] = { 1.f, 0.f, 0.f }; float r1 = 1.f; float r2 = 1.f; if (lib3d_basic_sphere_sphere(c1, r1, c2, r2)) { wprintf_s(L"spheres overlap./n"); } float start[3] = { 0, 0, 0 }; float dir[3] = { 0, 0, 1 }; float centers[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, }; float radius[] = { 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, }; if (lib3d_basic_ray_spheres(start, dir, centers, radius, 9)) { wprintf_s(L"ray hit a sphere./n"); } return 0;}
开发者ID:rezanour,项目名称:exploratory2,代码行数:28,
示例6: BenchmarkStdSortvoid BenchmarkStdSort( int pLength ){ T *pArray = new T[pLength]; for ( int i = 0; i < pLength; i++ ) pArray[i] = rand( ); std::vector<T> vec( pArray, pArray + pLength ); wprintf_s( L"std::sort/n" ); Timer t; t.Start( ); std::sort( vec.begin( ), vec.end( ), std::less<T>( ) ); t.Stop( ); wprintf_s( L"Ascending (random): %0.2fms/n", t.GetTimeElapsed( ) ); t.Start( ); std::sort( vec.begin( ), vec.end( ), std::less<T>( ) ); t.Stop( ); wprintf_s( L"Ascending (presorted): %0.2fms/n", t.GetTimeElapsed( ) ); t.Start( ); std::sort( vec.begin( ), vec.end( ), std::greater<T>( ) ); t.Stop( ); wprintf_s( L"Ascending (reverse presorted): %0.2fms/n/n", t.GetTimeElapsed( ) ); delete[] pArray;}
开发者ID:A200K,项目名称:Sort,代码行数:28,
示例7: CtrlHandler//Catch Control-C exception from keyboard.BOOL WINAPI CtrlHandler( _In_ const DWORD fdwCtrlType){//Print to screen. if (GlobalRunningStatus.Console) { switch (fdwCtrlType) { case CTRL_C_EVENT: //Handle the CTRL-C signal. { wprintf_s(L"Get Control-C./n"); }break; case CTRL_BREAK_EVENT: //Handle the CTRL-Break signal. { wprintf_s(L"Get Control-Break./n"); }break; default: //Handle other signals. { wprintf_s(L"Get closing signal./n"); }break; } } return FALSE;}
开发者ID:qq98982,项目名称:Pcap_DNSProxy,代码行数:26,
示例8: NiashLibUsbOpenint NiashLibUsbOpen(char const * const pszName, EScannerModel* const peModel){ //Open a handle to the device (FILE_FLAG_OVERLAPPED for WinUSB) s_hDevice = CreateFileA(pszName, GENERIC_READ|GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, 0, NULL); if(s_hDevice == INVALID_HANDLE_VALUE) { wprintf_s(L"CreateFile: %s/n", _com_error(GetLastError()).ErrorMessage()); return -1; } DEVICE_DESCRIPTOR dd; DWORD dwBytesReturned; if(!DeviceIoControl(s_hDevice,static_cast<DWORD>(IOCTL_GET_DEVICE_DESCRIPTOR),nullptr,0,&dd,sizeof(dd),&dwBytesReturned,nullptr)) { wprintf_s(L"DeviceIoControl: %s/n", _com_error(GetLastError()).ErrorMessage()); return -1; } //Report device to niash TScannerModel* pModel; MatchUsbDevice(dd.usVendorId,dd.usProductId,&pModel); *peModel = pModel->eModel; return 1;}
开发者ID:mkentie,项目名称:3300c,代码行数:26,
示例9: NiashLibUsbWriteBulkvoid NiashLibUsbWriteBulk(const int iHandle, SANE_Byte* const pabData, const int iSize){ assert(iHandle==1); assert(s_hWinUSB); assert(s_Pipes.BulkOut); //Send setup packet SANE_Byte abSetup[8] = { 0x01, 0x01, 0x00, 0x00, (iSize) & 0xFF, (iSize >> 8) & 0xFF, 0x00, 0x00 }; WINUSB_SETUP_PACKET Packet; Packet.RequestType = BMREQUEST_HOST_TO_DEVICE<<7|BMREQUEST_VENDOR<<5; //Vendor type request, PC to device Packet.Request = 0x04; //Send multiple bytes Packet.Value = static_cast<USHORT>(USB_SETUP); Packet.Index = 0x00; Packet.Length = 0x08; SendControlTransfer(Packet,abSetup); ULONG LengthTransferred; if(!WinUsb_WritePipe(s_hWinUSB, s_Pipes.BulkOut, pabData, iSize, &LengthTransferred, nullptr)) { wprintf_s(L"WinUsb_WritePipe: %s/n", _com_error(GetLastError()).ErrorMessage()); return; }}void NiashLibUsbReadBulk (const int iHandle, SANE_Byte* const pabData, const int iSize){ assert(iHandle==1); assert(s_hWinUSB); assert(s_Pipes.BulkIn); //Send setup packet SANE_Byte abSetup[8] = { 0x00, 0x00, 0x00, 0x00, (iSize) & 0xFF, (iSize >> 8) & 0xFF, 0x00, 0x00 }; WINUSB_SETUP_PACKET Packet; Packet.RequestType = BMREQUEST_HOST_TO_DEVICE<<7|BMREQUEST_VENDOR<<5; //Vendor type request, PC to device Packet.Request = 0x04; //Send multiple bytes Packet.Value = static_cast<USHORT>(USB_SETUP); Packet.Index = 0x00; Packet.Length = 0x08; SendControlTransfer(Packet,abSetup); ULONG LengthTransferred; if(!WinUsb_ReadPipe(s_hWinUSB, s_Pipes.BulkIn, pabData, iSize, &LengthTransferred, nullptr)) { wprintf_s(L"WinUsb_WritePipe: %s/n", _com_error(GetLastError()).ErrorMessage()); return; }}void NiashLibUsbWaitForInterrupt(){ assert(s_hWinUSB); assert(s_Pipes.Interrupt); BYTE buf[1]; ULONG LengthTransferred; if(!WinUsb_ReadPipe(s_hWinUSB,s_Pipes.Interrupt,buf,_countof(buf),&LengthTransferred,nullptr)) { wprintf_s(L"WinUsb_ReadPipe: %s/n", _com_error(GetLastError()).ErrorMessage()); return; }}
开发者ID:mkentie,项目名称:3300c,代码行数:60,
示例10: FlushDNSMailSlotSender//MailSlot of flush DNS cache senderbool WINAPI FlushDNSMailSlotSender( void){//Create mailslot. HANDLE hFile = CreateFileW(MAILSLOT_NAME, GENERIC_WRITE, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (hFile == INVALID_HANDLE_VALUE) { wprintf_s(L"Create mailslot error, error code is %lu./n", GetLastError()); return false; }//Write into mailslot. DWORD cbWritten = 0; if (!WriteFile(hFile, MAILSLOT_MESSAGE_FLUSH_DNS, (DWORD)(lstrlenW(MAILSLOT_MESSAGE_FLUSH_DNS) + 1U) * sizeof(wchar_t), &cbWritten, nullptr)) { wprintf_s(L"MailSlot write messages error, error code is %lu./n", GetLastError()); CloseHandle(hFile); return false; } CloseHandle(hFile); wprintf_s(L"Flush DNS cache message was sent successfully./n"); return true;}
开发者ID:qq98982,项目名称:Pcap_DNSProxy,代码行数:26,
示例11: BenchmarkSortvoid BenchmarkSort( SortBase<T> *pSort, int pLength ){ T *pArray = new T[pLength]; for ( int i = 0; i < pLength; i++ ) pArray[i] = rand( ); wprintf_s( L"%ls/n", pSort->GetName( ) ); Timer t; t.Start( ); pSort->DoSort( pArray, SD_ASCENDING, 0, pLength - 1 ); t.Stop( ); wprintf_s( L"Ascending (random): %0.2fms/n", t.GetTimeElapsed( ) ); t.Start( ); pSort->DoSort( pArray, SD_ASCENDING, 0, pLength - 1 ); t.Stop( ); wprintf_s( L"Ascending (presorted): %0.2fms/n", t.GetTimeElapsed( ) ); t.Start( ); pSort->DoSort( pArray, SD_DESCENDING, 0, pLength - 1 ); t.Stop( ); wprintf_s( L"Descending (reverse presorted): %0.2fms/n/n", t.GetTimeElapsed( ) ); delete[] pArray;}
开发者ID:A200K,项目名称:Sort,代码行数:26,
示例12: NiashLibUsbOpenint NiashLibUsbOpen(char const * const pszName, EScannerModel* const peModel){ //Open a handle to the device (FILE_FLAG_OVERLAPPED for WinUSB) s_hDevice = CreateFileA(pszName, GENERIC_READ|GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); //s_hDevice = CreateFileA("////.//Usbscan0", GENERIC_READ|GENERIC_WRITE, 0, nullptr, OPEN_EXISTING, FILE_FLAG_OVERLAPPED, NULL); if(s_hDevice == INVALID_HANDLE_VALUE) { wprintf_s(L"CreateFile: %s/n", _com_error(GetLastError()).ErrorMessage()); return -1; } //Open a WinUSB handle if(!WinUsb_Initialize(s_hDevice,&s_hWinUSB)) { wprintf_s(L"WinUsb_Initialize: %s/n", _com_error(GetLastError()).ErrorMessage()); return -1; } //Get interface descriptor USB_INTERFACE_DESCRIPTOR USBInterfaceDescriptor; if(!WinUsb_QueryInterfaceSettings(s_hWinUSB,0,&USBInterfaceDescriptor)) { wprintf_s(L"WinUsb_QueryInterfaceSettings: %s/n", _com_error(GetLastError()).ErrorMessage()); return -1; } //Find pipes for(UCHAR i = 0;i < USBInterfaceDescriptor.bNumEndpoints;i++) { WINUSB_PIPE_INFORMATION Pipe; WinUsb_QueryPipe(s_hWinUSB,0,i,&Pipe); if(Pipe.PipeType == UsbdPipeTypeInterrupt) { s_Pipes.Interrupt = Pipe.PipeId; } else if(Pipe.PipeType == UsbdPipeTypeBulk) { if(USB_ENDPOINT_DIRECTION_IN(Pipe.PipeId)) { s_Pipes.BulkIn = Pipe.PipeId; } else { s_Pipes.BulkOut = Pipe.PipeId; } } } if(!s_Pipes.Interrupt || !s_Pipes.BulkIn || !s_Pipes.BulkOut) { puts("Not all required pipes found."); return -1; } assert(s_pScannerModel); *peModel = s_pScannerModel->eModel; return 1;}
开发者ID:mkentie,项目名称:3300c,代码行数:59,
示例13: ModifyMyString/****************************************************************************Function: ModifyMyStringParameters: pStr : Pointer to pointer to UNICODE stringReturns: nonePurpose: Display the string passed in, modify it, and returnComments: This sample is meant to demonstrate a typical use of the represent_as attribute: The client and server have different local views of the data, although the IDL file describes the wire contract.****************************************************************************/void ModifyMyString(IN RPC_BINDING_HANDLE hBinding, WCHAR_STRING * pStr){ wprintf_s(L"/nModifyMyString: received UNICODE string:/n%s/n/n", *pStr ); wcscpy_s(*pStr,wcslen(*pStr), L"This UNICODE string comes back on the wire as ASCII"); wprintf_s(L"ModifyMyString: sending UNICODE string:/n%s/n/n", *pStr );}
开发者ID:Essjay1,项目名称:Windows-classic-samples,代码行数:24,
示例14: unpackint unpack(const wchar_t* path){ FILE* fp = 0; _wfopen_s(&fp, path, L"rb"); if (fp == 0) { wprintf_s(L"%s open fail/n", path); return 1; } fseek(fp, 0, SEEK_SET); YKCHDR hdr = { 0 }; fread(&hdr, sizeof(YKCHDR), 1, fp); if (memcmp(hdr.signature, "YKC001", 6) != 0) { wprintf_s(L"%s format error/n", path); exit(1); } char* toc = new char[hdr.toc_length]; fseek(fp, hdr.toc_offset, SEEK_SET); fread(toc, 1, hdr.toc_length, fp); YKCENTRY* table = (YKCENTRY*)toc; fs::path rawname = path; auto outdir = rawname.replace_extension(); for (unsigned int i = 0; i != hdr.toc_length / sizeof(YKCENTRY); ++i) { char elefn[200]; fseek(fp, table[i].filename_offset, SEEK_SET); fread(elefn, 1, table[i].filename_length, fp); auto outname = outdir; outname.append(elefn); char* buff = new char[table[i].data_length]; fseek(fp, table[i].data_offset, SEEK_SET); fread(buff, 1, table[i].data_length, fp); if (memcmp(buff, "YKG000", 6) == 0) { write_pic(outname, buff, table[i].data_length); } else { write_file(outname, buff, table[i].data_length); } delete[] buff; } fclose(fp); delete[] toc; return 0;}
开发者ID:Iratu,项目名称:FuckGalEngine,代码行数:58,
示例15: CreateDevice/*------------------------------------------- デバイスの作成--------------------------------------------*/HRESULT CreateDevice(void){ HRESULT hr; // ハ C++ wprintw函数代码示例 C++ wprintf函数代码示例
|