久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

<tfoot id='yRmiR'></tfoot>
    <legend id='yRmiR'><style id='yRmiR'><dir id='yRmiR'><q id='yRmiR'></q></dir></style></legend>
    <i id='yRmiR'><tr id='yRmiR'><dt id='yRmiR'><q id='yRmiR'><span id='yRmiR'><b id='yRmiR'><form id='yRmiR'><ins id='yRmiR'></ins><ul id='yRmiR'></ul><sub id='yRmiR'></sub></form><legend id='yRmiR'></legend><bdo id='yRmiR'><pre id='yRmiR'><center id='yRmiR'></center></pre></bdo></b><th id='yRmiR'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='yRmiR'><tfoot id='yRmiR'></tfoot><dl id='yRmiR'><fieldset id='yRmiR'></fieldset></dl></div>

      <small id='yRmiR'></small><noframes id='yRmiR'>

        • <bdo id='yRmiR'></bdo><ul id='yRmiR'></ul>

        如何將 char* 轉換為 wchar_t*?

        How to convert char* to wchar_t*?(如何將 char* 轉換為 wchar_t*?)
          <tbody id='eOkg8'></tbody>

      1. <tfoot id='eOkg8'></tfoot>
          <legend id='eOkg8'><style id='eOkg8'><dir id='eOkg8'><q id='eOkg8'></q></dir></style></legend>

            <bdo id='eOkg8'></bdo><ul id='eOkg8'></ul>

          • <small id='eOkg8'></small><noframes id='eOkg8'>

            <i id='eOkg8'><tr id='eOkg8'><dt id='eOkg8'><q id='eOkg8'><span id='eOkg8'><b id='eOkg8'><form id='eOkg8'><ins id='eOkg8'></ins><ul id='eOkg8'></ul><sub id='eOkg8'></sub></form><legend id='eOkg8'></legend><bdo id='eOkg8'><pre id='eOkg8'><center id='eOkg8'></center></pre></bdo></b><th id='eOkg8'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='eOkg8'><tfoot id='eOkg8'></tfoot><dl id='eOkg8'><fieldset id='eOkg8'></fieldset></dl></div>

                  本文介紹了如何將 char* 轉換為 wchar_t*?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我嘗試過實現這樣的功能,但不幸的是它不起作用:

                  I've tried implementing a function like this, but unfortunately it doesn't work:

                  const wchar_t *GetWC(const char *c)
                  {
                      const size_t cSize = strlen(c)+1;
                      wchar_t wc[cSize];
                      mbstowcs (wc, c, cSize);
                  
                      return wc;
                  }
                  

                  我的主要目標是能夠在 Unicode 應用程序中集成普通字符字符串.非常感謝你們提供的任何建議.

                  My main goal here is to be able to integrate normal char strings in a Unicode application. Any advice you guys can offer is greatly appreciated.

                  推薦答案

                  使用 std::wstring 而不是 C99 變長數組.當前標準保證 std::basic_string 的連續緩沖區.例如,

                  Use a std::wstring instead of a C99 variable length array. The current standard guarantees a contiguous buffer for std::basic_string. E.g.,

                  std::wstring wc( cSize, L'#' );
                  mbstowcs( &wc[0], c, cSize );
                  

                  C++ 不支持 C99 可變長度數組,因此如果您將代碼編譯為純 C++,它甚至無法編譯.

                  C++ does not support C99 variable length arrays, and so if you compiled your code as pure C++, it would not even compile.

                  隨著更改,您的函數返回類型也應該是 std::wstring.

                  With that change your function return type should also be std::wstring.

                  記得在main中設置相關的locale.

                  Remember to set relevant locale in main.

                  例如,setlocale( LC_ALL, "" ).

                  這篇關于如何將 char* 轉換為 wchar_t*?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  In what ways do C++ exceptions slow down code when there are no exceptions thown?(當沒有異常時,C++ 異常會以何種方式減慢代碼速度?)
                  Why catch an exception as reference-to-const?(為什么要捕獲異常作為對 const 的引用?)
                  When and how should I use exception handling?(我應該何時以及如何使用異常處理?)
                  Scope of exception object in C++(C++中異常對象的范圍)
                  Catching exceptions from a constructor#39;s initializer list(從構造函數的初始化列表中捕獲異常)
                  Difference between C++03 throw() specifier C++11 noexcept(C++03 throw() 說明符 C++11 noexcept 之間的區別)

                  1. <small id='vnpPI'></small><noframes id='vnpPI'>

                      <tbody id='vnpPI'></tbody>
                      • <i id='vnpPI'><tr id='vnpPI'><dt id='vnpPI'><q id='vnpPI'><span id='vnpPI'><b id='vnpPI'><form id='vnpPI'><ins id='vnpPI'></ins><ul id='vnpPI'></ul><sub id='vnpPI'></sub></form><legend id='vnpPI'></legend><bdo id='vnpPI'><pre id='vnpPI'><center id='vnpPI'></center></pre></bdo></b><th id='vnpPI'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='vnpPI'><tfoot id='vnpPI'></tfoot><dl id='vnpPI'><fieldset id='vnpPI'></fieldset></dl></div>
                          • <bdo id='vnpPI'></bdo><ul id='vnpPI'></ul>
                            <tfoot id='vnpPI'></tfoot>
                            <legend id='vnpPI'><style id='vnpPI'><dir id='vnpPI'><q id='vnpPI'></q></dir></style></legend>
                            主站蜘蛛池模板: 一区二区三区免费 | 国产精品视频久久久 | 日日人人 | 91av导航 | 天堂一区在线 | 一级片片| 黄色一级免费看 | 99国产精品久久久久久久 | 成人国产精品久久 | 超级碰在线 | av片在线观看 | 一区二区三区四区毛片 | 国产精品日韩在线观看一区二区 | 免费精品视频 | 国产羞羞视频在线观看 | 天天草天天操 | 国产精品高潮呻吟久久 | 免费观看黄色片视频 | 毛片入口| 一a级片| 国产人成精品一区二区三 | 国产视频一区在线 | 亚洲欧美日韩在线 | 伊人焦久影院 | 国产精品777一区二区 | 成人中文字幕在线观看 | 国产精品日产欧美久久久久 | 日本免费网| 日韩av在线一区二区 | 日本精品一区二区三区在线观看视频 | 亚洲视频免费观看 | 天天干.com| 婷婷毛片| 国产欧美日韩视频 | 在线男人天堂 | 天堂国产| 中文字幕一二三 | 精品欧美激情精品一区 | 成人免费看黄网站在线观看 | 在线一区二区三区 | 一区二区亚洲 |