zoukankan      html  css  js  c++  java
  • wxstring与其他类型转换

    wxstring与其他类型转换

     1 1.1 int to wxString:    
     2 wxString str = wxString::Format(wxT("%i"),myInt);
     3 1.2   wxString to int :     
     4 int i; i = wxAtoi(str);
     5 1.3   string to wxString:    
     6 std::string stlString = "sdfas"; wxString mystr(stlString .c_str(),wxConvUTF8);
     7 1.4   wxString to string:    
     8 wxString mystring(wxT("HelloWorld"));
     9 std::string stlstring = std::string(mystring.mb_str());
    10 1.5  char* to wxString:
    11 char* chars = "Hello world";
    12 wxString mystring(chars, wxConvUTF8);
    13 1.6   wxString to  char*:   
    14 char* cs = str.mb_str(wxConvUTF8);
    15 法2:wxString to UTF-8 to char*(即string)
    16 wxString wx;const wxCharBuffer wxc = wx.ToUTF8(); const char *wxs= wxc;
    17 1.7    char[] to wxString:
    18 char chars[34] = "sefasd";
    19 wxstring mystring(chars, wxConvUTF8);
    20 1.8  wxString to char[]:
    21 wxString mystring(wxT("HelloWorld"));
    22 char cstring[1024];
    23 strcpy(cstring, (const char*)mystring.mb_str(wxConvUTF8));
    24  
    25 wxdatetime 与wxstring转换
    26 2.1  wxdatetime to wxstring :
    27 wxDateTime dt = CalendarCtrl1->GetDate();
    28 wxString msg = dt.Format(wxT("%Y-%m-%d"),wxDateTime::A_EST);
    29 2.2 wxstring to wxdatetime:   char* ca = "2008-09-03";wxDateTime dt;dt.ParseDate(ca);
    
    
  • 相关阅读:
    代码注入——c++代码注入
    Windows 用来定位 DLL 的搜索路径
    LoadLibraryA与GetProcAddress介绍
    DLL 函数导出的规则和方法
    C++ dll的隐式与显式调用
    C++ main函数的参数
    DLL注入之修改PE静态注入
    用户权限设置和进程权限提升
    DLL注入之windows消息钩取
    c++回调函数
  • 原文地址:https://www.cnblogs.com/starf/p/3657149.html
Copyright © 2011-2022 走看看