⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 win32.h

📁 本人收集整理的一份c/c++跨平台网络库
💻 H
字号:
#ifndef UTILS_BASE_WIN32_H_#define UTILS_BASE_WIN32_H_#include <winsock2.h>#include <windows.h>#include <malloc.h>#include <string>namespace utils_base {///////////////////////////////////////////////////////////////////////////////inline std::wstring ToUtf16(const std::string& str) {  int len16 = ::MultiByteToWideChar(CP_UTF8, 0, str.data(), (int)str.length(),                                    NULL, 0);  wchar_t *ws = static_cast<wchar_t*>(_alloca(len16 * sizeof(wchar_t)));  ::MultiByteToWideChar(CP_UTF8, 0, str.data(), (int)str.length(), ws, len16);  std::wstring result(ws, len16);  return result;}inline std::string ToUtf8(const std::wstring& wstr) {  int len8 = ::WideCharToMultiByte(CP_UTF8, 0, wstr.data(), (int)wstr.length(),                                   NULL, 0, NULL, NULL);  char* ns = static_cast<char*>(_alloca(len8));  ::WideCharToMultiByte(CP_UTF8, 0, wstr.data(), (int)wstr.length(),                        ns, len8, NULL, NULL);  std::string result(ns, len8);  return result;}// Convert FILETIME to time_tinline void FileTimeToUnixTime(const FILETIME& ft, time_t* ut)/// yzxu_alter{	SYSTEMTIME systime;	if (FileTimeToSystemTime(&ft, &systime))		*ut = (time_t)systime.wMilliseconds;	else		*ut = (time_t)0;}// Convert time_t to FILETIMEinline void UnixTimeToFileTime(const time_t& ut, FILETIME * ft)/// yzxu_alter{	SYSTEMTIME systime;	systime.wMilliseconds = (WORD)ut;	SystemTimeToFileTime(&systime, ft);}///////////////////////////////////////////////////////////////////////////////}  // namespace utils_base#endif  // UTILS_BASE_WIN32_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -