zoukankan      html  css  js  c++  java
  • wcstombs_s 宽字节转多字节

    // crt_wcstombs_s.c  
    // This example converts a wide character  
    // string to a multibyte character string.  
    #include <stdio.h>  
    #include <stdlib.h>  
    #include <assert.h>  
      
    #define BUFFER_SIZE 100  
      
    int main( void )  
    {  
        size_t   i;  
        char      *pMBBuffer = (char *)malloc( BUFFER_SIZE );  
        wchar_t*pWCBuffer = L"Hello, world.";  
      
        printf( "Convert wide-character string:
    " );  
      
        // Conversion  
        wcstombs_s(&i, pMBBuffer, (size_t)BUFFER_SIZE,   
                   pWCBuffer, (size_t)BUFFER_SIZE );  
      
        // Output  
        printf("   Characters converted: %u
    ", i);  
        printf("    Multibyte character: %s
    
    ",  
         pMBBuffer );  
      
        // Free multibyte character buffer  
        if (pMBBuffer)  
        {  
        free(pMBBuffer);  
        }  
    } 
    

      

    From: https://blog.csdn.net/ychw365/article/details/7034950 

  • 相关阅读:
    iOS-导航条
    iOS-存储
    iOS-模型传递
    iOS-日期相关
    iOS-UIViewController
    iOS-loadView方法
    iOS-UIWindow
    Spring 测试
    Spring条件注解@Conditional
    Spring多线程
  • 原文地址:https://www.cnblogs.com/time-is-life/p/9109244.html
Copyright © 2011-2022 走看看