#include <Windows.h>
#include <stdio.h>void main()
{
LONGLONG l; wchar_t wszBuf[200]; wsprintf(wszBuf,L"%lld",l);
}执行到 wsprintf处就会出错,还请各位帮忙

解决方案 »

  1.   

    wsprintfW(wszBuf, L"%ld\n", l); 
      

  2.   

    #include <Windows.h> 
    #include <stdio.h> void main() 

    LONGLONG l=9; 

    wchar_t wszBuf[200]; 

    wsprintfW(wszBuf, L"%ld\n", l); 
    wprintf(wszBuf);

    over,给分
      

  3.   

    Value Meaning 
      c Single character. This value is interpreted as type WCHAR if the calling application defines Unicode and as type __wchar_t otherwise. 
      C Single character. This value is interpreted as type __wchar_t if the calling application defines Unicode and as type WCHAR otherwise. 
      d Signed decimal integer. This value is equivalent to i. 
      hc, hC Single character. The wsprintf function ignores character arguments with a numeric value of zero. This value is always interpreted as type __wchar_t, even when the calling application defines Unicode. 
      hd Signed short integer argument. 
      hs, hS String. This value is always interpreted as type LPSTR, even when the calling application defines Unicode. 
      hu Unsigned short integer. 
      i Signed decimal integer. This value is equivalent to d. 
      lc, lC Single character. The wsprintf function ignores character arguments with a numeric value of zero. This value is always interpreted as type WCHAR, even when the calling application does not define Unicode. 
      ld Long signed integer. This value is equivalent to li. 
      li Long signed integer. This value is equivalent to ld. 
      ls, lS String. This value is always interpreted as type LPWSTR, even when the calling application does not define Unicode. This value is equivalent to ws. 
      lu Long unsigned integer. 
      lx, lX Long unsigned hexadecimal integer in lowercase or uppercase. 
      p Windows 2000/XP: Pointer. The address is printed using hexadecimal.  
      s String. This value is interpreted as type LPWSTR when the calling application defines Unicode and as type LPSTR otherwise. 
      S String. This value is interpreted as type LPSTR when the calling application defines Unicode and as type LPWSTR otherwise. 
      u Unsigned integer argument. 
      x, X Unsigned hexadecimal integer in lowercase or uppercase. 
      

  4.   

    wsprintf(wszBuf,L"%I64d",l);ld是32位,在32位程序中与d是相同的,是从早期16位程序中延续下来的。
      

  5.   

    #include <Windows.h>
    #include <stdio.h>void main()
    {
    LONGLONG l = 100; wchar_t wszBuf[200]; wsprintf(wszBuf,L"%ld",l); wchar_t wstr[50] = L"$MFT";
    wchar_t wstr2[50];
    wcscpy(wstr2,wstr); //这样会把字符串的空间挤掉?
    wsprintf(wszBuf,L"%-20lu %-10ls",l,wstr2);
    }为什么wszBuf中没有 wstr2的内容
      

  6.   

    wsprintf(wszBuf,L"%-20lu %-10s",l,wstr2); 
      

  7.   

    l只能与表示数值的o、u、x搭配。