zoukankan      html  css  js  c++  java
  • c++ 向main传递参赛

    1.今天写了个批处理文件 准备向main传递参赛  发现在vs2008运行正常 vs2010运行只有首字母

    2.需要在项目--属性--常规-字符集里面设置成多字节就好了,以前是unicode

    3.因为

    char:计算机编程语言(c、c++、java、VFP等)中可容纳单个字符的一种基本数据类型。

    TCHAR:为了满足Unicode编码,对char的扩展,即_T(“str”)表示TCHAR类型

    C++支持两种字符串,即常规的ANSI编码(使用""包裹)和Unicode编码(使用L""包裹),这样对应的就有了两套字符串字符串处理函数,比如:strlen和wcslen,分别用于处理两种字符串char和TCHAR类型

    winnt.h头文件中:
         typedef WCHAR TCHAR, *PTCHAR; 
    表明 TCHAR 与 WCHAR 属同一类型
    
    char szA[100];                    // ANSI string buffer
    WCHAR szW[100];            // Unicode string buffer
    
    
    // Normal sprintf:all strings are ANSI
    sprintf(szA, "%s","ANSI Str");
    
    // Converts Unicode string to ANSI
    sprintf(szA,"%S",L"Unicode Str");
    
    // Normal swprintf:all strings are Unicode
    swprintf(szW,L"%s",L"Unicode Str");
    
    // Converts ANSI string to Unicode
    swprintf(szW,L"%S", "ANSI Str");
    

      

  • 相关阅读:
    用Total Commander for Android管理应用程序
    我的zsh简单设置
    C# Newtonsoft.Json 使用
    Wireshark 抓包 test
    C# 调用API test
    C# 委托 的语法 之一
    C# 对象初始化器 和数组初始化语法
    C 语言 数据类型长度
    vue 使用 test
    test
  • 原文地址:https://www.cnblogs.com/yelongsan/p/4253066.html
Copyright © 2011-2022 走看看