zoukankan      html  css  js  c++  java
  • LPWSTR wprintf 规格严格

    因为LPWSTR指向的是一个宽字符串,而printf()是针对通常的字符串(非宽字符串)的,所以两者的类型不匹配,应该使用wprintf()

    s String When used with printf functions, specifies a single-byte–character string; when used with wprintf functions, specifies a wide-character string. Characters are printed up to the first null character or until the precision value is reached. 
    S String When used with printf functions, specifies a wide-character string; when used with wprintf functions, specifies a single-byte–character string. Characters are printed up to the first null character or until the precision value is reached. 

    #define __T(x) L ## x
    ...
    #define _T(x) __T(x)
    #define _TEXT(x) __T(x)
    ...

    MSDN98
    mk:@MSITStore:C:\MSDN98\98VS\2052\vclang.chm::/html/_pluslang_c.2b2b_.string_literals.htm

    C++ String Literals
    A string literal consists of zero or more characters from the source character set surrounded by double quotation marks ("). A string literal represents a sequence of characters that, taken together, form a null-terminated string.

    Syntax

    string-literal :

    "s-char-sequenceopt"
    L"s-char-sequenceopt"

    ...
    To specify a string of type wide-character (wchar_t[]), precede the opening double quotation mark with the character L. For example:

    wchar_t wszStr[] = L"1a1g";

    http://msdn.microsoft.com/en-us/library/ms686944(v=VS.85).aspx

  • 相关阅读:
    Hibernate 总结
    Mybatis 总结
    Mybatis原生DataSource源码解析
    Spring Cloud 服务安全
    Mybatis原生源码解析
    最好的Http客户端--Feign 源码分析
    Zuul整合Hystrix断路器
    Zuul核心-预定义Filter
    Feign性能优化
    Feign整合Ribbon负载均衡
  • 原文地址:https://www.cnblogs.com/diyunpeng/p/2324358.html
Copyright © 2011-2022 走看看